Repository navigation
Add WPT target for html/webappapis/structured-clone - #8135
Conversation
476815d to
1c630d3
Compare
There was a problem hiding this comment.
💬 Approved with comments — The test configuration is clean and every expected failure is explained. One optional comment-wording suggestion remains.
Findings: 1 suggestion
The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.
📝 Documentation: 💬 1 suggestion
One wording suggestion remains: the comment does not say the transfer limitation is specific to workerd.
Recommendation: 💬 Optional Nits
- [SUGGESTION] Say that the transfer limitation is specific to workerd (e.g. "workerd's structuredClone can only transfer ArrayBuffers"). As written, the comment suggests the standard API only supports transferring ArrayBuffers. (
src/wpt/html/webappapis/structured-clone-test.ts:45)
View full review
src/wpt/html/webappapis/structured-clone-test.ts:45-46: "structuredClone can only transfer ArrayBuffers" can be read as a statement about the API in general. The standard also allows transferring MessagePorts and ReadableStreams. Saying "workerd's structuredClone" would make it clear that this is a workerd limitation.
✅ All other checks passed
📋 Code Quality: ✅ LGTM
The new html/webappapis/structured-clone target in src/wpt/BUILD.bazel is correct. The module is listed as both wpt_directory and extra_wpt_directories on purpose: build/wpt_test.bzl removes the duplicate from data and still binds the module under its absolute path. The tests' META: script=/html/webappapis/structured-clone/... lines need that path. In the test config, the battery helper files are omitted and every expected failure has a comment explaining it.
Reviewed commit: 1c630d35
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## automatic-update-wpt #8135 +/- ##
=======================================================
Coverage ? 68.31%
=======================================================
Files ? 726
Lines ? 189662
Branches ? 29672
=======================================================
Hits ? 129568
Misses ? 42719
Partials ? 17375 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Runs the structuredClone() battery of tests (structured-clone.any.js), which clones and transfers primitives, wrappers, dates, regexps, errors, buffers, views, Blobs, Files, MessagePorts and more. The three battery helper files that discovery picks up are omitted. 117 of 135 subtests pass; 18 are expected failures and 2 (ImageBitmap, OffscreenCanvas) are omitted because workerd has no canvas APIs. The expected failures fall into these groups: - enhanced_error_serialization deliberately clones custom error properties (8 subtests). - File is not serializable, although Blob is. - structuredClone(new Response()) succeeds instead of throwing a DataCloneError. - Only ArrayBuffers can be transferred: MessagePort and ReadableStream transfers throw TypeError, and transferring a Blob throws TypeError instead of a DataCloneError. - Transferring a detached ArrayBuffer succeeds. - "Growable SharedArrayBuffer" compares a SharedArrayBuffer with `instanceof ArrayBuffer`, which only passes in browsers because they refuse to clone SABs without cross-origin isolation. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1c630d3 to
c815485
Compare
Adds a WPT target for
html/webappapis/structured-clone: 117 of 135 subtests pass and 18 are expected failures.The expected failures:
enhanced_error_serializationcompat flag copies an error's custom own properties, and gives an Error with an empty message its ownmessageproperty. The spec does neither, but workerd does this on purpose.structuredClone(new Response())succeeds; the spec requires a DataCloneError.instanceof ArrayBuffer, which is never true.