feat(ses): Opt out of namespace boxes #2380
Merged
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.
Refs: #400
Description
To reduce mismatched behavior between SES and XS, this change adds an option (to be removed at the next major version) that changes the compartment import method such that it returns a promise for an exports namespace instead of a promise for a box containing the imports namespace. This opts-in to the same thenable behavior as dynamic import in the language.
Security Considerations
With this option, we must be weary of thenable modules, as we must be for thenable modules across the rest of the JavaScript ecosystem.
Scaling Considerations
None.
Documentation Considerations
This option will necessarily appear in all portable code examples on hardenedjs.org once it is available.
Testing Considerations
Tests have been adjusted to take advantage of the new option, except legacy tests which remain to test the behavior without the option enabled.
Compatibility Considerations
This is a backward compatible change. Namespace boxes are hereafter deprecated and we hope to remove this option on the next major release, making the new behavior mandatory or at least opt-out.
Upgrade Considerations
None.