Skip to content

fix(immutable-arraybuffer): capture structuredClone early#2853

Merged
erights merged 2 commits into
masterfrom
markm-capture-structuredClone
Jun 11, 2025
Merged

fix(immutable-arraybuffer): capture structuredClone early#2853
erights merged 2 commits into
masterfrom
markm-capture-structuredClone

Conversation

@erights

@erights erights commented Jun 10, 2025

Copy link
Copy Markdown
Contributor

Closes: #XXXX
Refs: #2785

Description

The Immutable ArrayBuffer shim, on non-Hermes, relies on the existence of either a global structuredClone or Array.prototype.transfer. However, I forgot to capture early the global structuredClone into a module-local one, and to then use that repeatedly. MetaMask scuttling deleted the global structuredClone, running headlong into my mistake on platforms (Node 18 and Node 20) that do not also have Array.prototype.transfer.

This PR fixes that mistake, capturing structuredClone early, and then using the resulting module-local one.

Security Considerations

The bug this PR fixes was a security hazard.

Scaling Considerations

none

Documentation Considerations

none

Testing Considerations

In theory, we should add scuttling as an orthogonal dimension of our platform testing matrix. However that is rather expensive for minor benefit.

Compatibility Considerations

The bug created compat problems that this PR fixes.

Upgrade Considerations

none

@erights erights self-assigned this Jun 10, 2025
@erights erights marked this pull request as ready for review June 10, 2025 23:59
@erights erights requested review from boneskull and kriskowal June 11, 2025 00:00
@erights erights merged commit a12c5c5 into master Jun 11, 2025
16 checks passed
@erights erights deleted the markm-capture-structuredClone branch June 11, 2025 00:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants