feat(ses): shim ArrayBuffer.prototype.transfer#2417
Merged
Conversation
4822621 to
2911043
Compare
Contributor
Author
2911043 to
4dd9bf8
Compare
b324de6 to
fc32323
Compare
4dd9bf8 to
d19e509
Compare
fc32323 to
4825656
Compare
d19e509 to
585042f
Compare
a3840c7 to
ca4b5fb
Compare
erights
added a commit
that referenced
this pull request
Aug 27, 2024
Closes: #2418 Refs: #2417 #1308 ## Description Adapted from #2419 (review) below The platform compatibility test specifically validates that SES works on Node.js 12 and can be deleted since it has vanished into history. Node.js 12 required special consideration because of its experimental ESM support. Delete the `test:platform-compatibility` script in the ses `package.json`, as well as the `test/package` fixture in ci.yml Immediate motivation explained in #2418 , #2417 broken the platform-compatibility-test tests because it depends on the platform providing either `Array.prototype.transfer` or `structuredClone`. Node supports `transfer` starting with Node 22, but supports `structuredClone` starting in Node 18. That should be fine, since that is our declared support floor. This PR changes our one known remaining dependence on Node 12. ### Security Considerations none ### Scaling Considerations none ### Documentation Considerations none beyond the need to explain our platform requirements, which this PR does not change. ### Testing Considerations The point. This PR only affects tests, not production code. Reviewers, should this PR be labeled `test:` instead of `fix:`? ### Compatibility and Upgrade Considerations After this PR, we will no longer notice further breakage on Node < 18. That fits with our declared support floor.
585042f to
c874e3c
Compare
kriskowal
reviewed
Aug 27, 2024
13e80da to
8dce401
Compare
8dce401 to
06e15fe
Compare
mhofman
requested changes
Sep 3, 2024
Contributor
mhofman
left a comment
There was a problem hiding this comment.
Please consider removing the unnecessary slice call as brand check, and improve support for when the new length doesn't match.
Contributor
Author
|
PTAL |
Contributor
Author
Done |
mhofman
requested changes
Sep 4, 2024
Contributor
mhofman
left a comment
There was a problem hiding this comment.
Thanks for addressing the previous feedback. There is indeed a better way to copy an array buffer,
mhofman
approved these changes
Sep 4, 2024
mhofman
reviewed
Sep 4, 2024
mhofman
reviewed
Sep 4, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Staged on #2419
Closes: #XXXX
Refs: #2414 #2418 #2419
Description
#2414 by itself does not work on Node 18 and Node 20 because
Array.prototype.transfer, so feat(pass-style,marshal): ByteArray, a binary Passable #2414 must usestructuredCloneinsteadstructuredClonedoes exist on Node >= 18, so it should be on supported platforms (though see The ses-shim tests on Node 12 despite our min support being Node 18 #2418 ). However,structuredCloneitself is dangerous and so must not be added to the shared intrinsics. As a result, in feat(pass-style,marshal): ByteArray, a binary Passable #2414 , when@endo/pass-styleis initialized in a created compartment, it fails to find eitherArray.prototype.transferand `structuredCloneTo solve this, @kriskowal suggested that we also shim
Array.prototype.transferif needed duringlockdown, along with other repairs. We are avoiding similarly shimmingArray.prototype.transferToImmutablebecause it is not yet standard. ButArray.prototype.transferis standard, and solockdowncan globally shim it before hardening the shared intrinsics.This PR implements @kriskowal 's suggestion.
Security Considerations
none
Scaling Considerations
by itself, none
Documentation Considerations
nothing signicant.
Testing Considerations
See #2418 . Aside from that, none
Compatibility and Upgrade Considerations
On platforms with neither
Array.prototype.transfernor a globalstructuredClone, the ses-shim will currently not install an emulation ofArray.prototype.transfer. However, once we verify that endo is not intended to support platforms without both, we may change lockdown to throw, failing to lock down.