Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable structuredClone testing in ShadowRealm #49282

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

ptomato
Copy link
Contributor

@ptomato ptomato commented Nov 20, 2024

Run the "structuredClone battery of tests" in the various ShadowRealm scopes. This requires using different objects in some cases where an example of a transferable or serializable object is needed. It also requires adding a mechanism to skip the Blob-specific tests.

Copy link
Member

@andreubotella andreubotella left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM modulo the proposed changes. I would also appreciate @domenic's review though.

We would like these tests to be run inside ShadowRealm as well. However,
there are few platform objects that are [Exposed=*, Transferable] (only
streams, of which the transferability is not widely implemented yet) and
also few platform objects that are [Exposed=*, Serializable] (only
DOMException).

Add feature detection to
structured-clone-battery-of-tests-with-transferables.js to try to use the
most appropriate transferable platform object for the environment running
the test. If MessagePort is available, use it; otherwise ReadableStream if
it is transferable; otherwise skip the test. (To be clear, streams are
specified to be transferable; but this test is not specifically about
that.)

As a non-transferable or non-serializable platform object, use
AbortController, which is [Exposed=*], instead of Blob or Response, which
are not.

Use DOMException where a serializable platform object is needed, instead
of Blob or File.
We would like these tests to be run inside ShadowRealm as well. Blob is
not annotated with [Exposed=*]. Similar to the mechanism used to skip
Document-specific tests in workers, skip Blob-specific tests if there is
no Blob.
Run the "structuredClone battery of tests" in the various ShadowRealm
environments. This includes making sure the various harness exports are
added as global properties.
@ptomato
Copy link
Contributor Author

ptomato commented Nov 20, 2024

Thanks for the review! I've made those changes you suggested.

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.

4 participants