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

WIP: SharedArrayBuffer structured cloning tests #5003

Merged
merged 25 commits into from
Apr 28, 2017
Merged

Conversation

domenic
Copy link
Member

@domenic domenic commented Feb 24, 2017

This is for whatwg/html#2518 which is ready to land.

Test plan (please suggest more!):

Success cases (test that modifying on both sides is reflected on the other):

  • postMessage between window and dedicated worker
  • postMessage between window and same-origin iframe
  • postMessage between window and same-origin-domain, but not same-origin, iframe
  • postMessage between window and its opener
  • postMessage between dedicated worker and nested dedicated worker
  • postMessage between shared worker and nested dedicated worker
  • postMessage between window and nested-nested-nested same-origin iframe
  • MessageChannel version of postMessage between window and dedicated worker
  • Every clone creates a distinct SAB object, that is not ===, even though the backing memory is shared
  • Test using BroadcastChannel where it all succeeds
  • All of the above with Uint8Array and DataView wrappers instead of directly using SABs.
  • Structured serialization via pushState/replaceState
  • postMessage between window and non-same-origin-domain iframe that is still in the same URSOBC

Failure cases that cause error behavior on the receiver side (messageerror event):

Failure cases that cause synchronous failure:

  • Putting the SAB in the transfer list
  • Structured serialization via Notifications API's data member
  • Writing a SAB to IDB

This change is Reviewable

@wpt-pr-bot
Copy link
Collaborator

Notifying @Ms2ger, @ayg, @jdm, @jgraham, @zcorpan, and @zqzhang. (Learn how reviewing works.)

@ghost
Copy link

ghost commented Feb 24, 2017

View the complete job log.

Firefox (nightly channel)

Testing web-platform-tests at revision 34ef0d4
Using browser at version BuildID 20170427100655; SourceStamp 0b77ed3f26c5335503bc16e85b8c067382e7bb1e
Starting 10 test iterations
All results were stable

All results

17 tests ran
/html/infrastructure/safe-passing-of-structured-data/shared-array-buffers/broadcastchannel-success-and-failure.html
Subtest Results Messages
OK
SharedArrayBuffer cannot cross agent clusters, BroadcastChannel edition FAIL SharedArrayBuffer cannot be cloned in this context
/html/infrastructure/safe-passing-of-structured-data/shared-array-buffers/broadcastchannel-success.html
Subtest Results Messages
OK
Structured cloning of SharedArrayBuffers: BroadcastChannel within the same agent cluster FAIL promise_test: Unhandled rejection with value: object "TypeError: SharedArrayBuffer cannot be cloned in this context"
/html/infrastructure/safe-passing-of-structured-data/shared-array-buffers/identity-not-preserved.html
Subtest Results Messages
OK
postMessaging to this window does not give back the same SharedArrayBuffer (but does use the same backing block) PASS
postMessaging to a worker and back does not give back the same SharedArrayBuffer PASS
postMessaging to an iframe and back does not give back the same SharedArrayBuffer PASS
/html/infrastructure/safe-passing-of-structured-data/shared-array-buffers/nested-worker-success-dedicatedworker.html
Subtest Results Messages
OK
postMessaging to a dedicated sub-worker allows them to see each others' modifications PASS {}
/html/infrastructure/safe-passing-of-structured-data/shared-array-buffers/nested-worker-success-sharedworker.html
Subtest Results Messages
OK
postMessaging to a dedicated sub-worker allows them to see each others' modifications PASS {}
/html/infrastructure/safe-passing-of-structured-data/shared-array-buffers/no-transferring.html
Subtest Results Messages
OK
Trying to transfer a SharedArrayBuffer to this window throws PASS
Trying to transfer a SharedArrayBuffer to a worker throws PASS
Trying to transfer a SharedArrayBuffer through a MessagePort throws PASS
/html/infrastructure/safe-passing-of-structured-data/shared-array-buffers/serialization-via-history.html
Subtest Results Messages
OK
history.pushState(): simple case FAIL assert_throws: function "() => {\n history[method](new SharedArrayBuffer(), "dummy title");\n }" threw object "TypeError: SharedArrayBuffer cannot be cloned in this context" that is not a DOMException DataCloneError: property "code" is equal to undefined, expected 25
history.pushState(): is interleaved correctly FAIL assert_throws: function "() => {\n history[method]([\n { get x() { getter1Called = true; return 5; } },\n new SharedArrayBuffer(),\n { get x() { getter2Called = true; return 5; } }\n ], "dummy title");\n }" threw object "TypeError: SharedArrayBuffer cannot be cloned in this context" that is not a DOMException DataCloneError: property "code" is equal to undefined, expected 25
history.replaceState(): simple case FAIL assert_throws: function "() => {\n history[method](new SharedArrayBuffer(), "dummy title");\n }" threw object "TypeError: SharedArrayBuffer cannot be cloned in this context" that is not a DOMException DataCloneError: property "code" is equal to undefined, expected 25
history.replaceState(): is interleaved correctly FAIL assert_throws: function "() => {\n history[method]([\n { get x() { getter1Called = true; return 5; } },\n new SharedArrayBuffer(),\n { get x() { getter2Called = true; return 5; } }\n ], "dummy title");\n }" threw object "TypeError: SharedArrayBuffer cannot be cloned in this context" that is not a DOMException DataCloneError: property "code" is equal to undefined, expected 25
/html/infrastructure/safe-passing-of-structured-data/shared-array-buffers/serialization-via-idb.any.worker.html
Subtest Results Messages
ERROR
/html/infrastructure/safe-passing-of-structured-data/shared-array-buffers/serialization-via-idb.any.html
Subtest Results Messages
OK
SharedArrayBuffer cloning via IndexedDB: basic case FAIL assert_throws: function "() => {\n store.put({ key: 1, property: new SharedArrayBuffer() });\n }" threw object "TypeError: SharedArrayBuffer cannot be cloned in this context" that is not a DOMException DataCloneError: property "code" is equal to undefined, expected 25
SharedArrayBuffer cloning via the IndexedDB: is interleaved correctly FAIL assert_throws: function "() => {\n store.put({ key: 1, property: [\n { get x() { getter1Called = true; return 5; } },\n new SharedArrayBuffer(),\n { get x() { getter2Called = true; return 5; } }\n ]});\n }" threw object "TypeError: SharedArrayBuffer cannot be cloned in this context" that is not a DOMException DataCloneError: property "code" is equal to undefined, expected 25
/html/infrastructure/safe-passing-of-structured-data/shared-array-buffers/serialization-via-notifications-api.any.html
Subtest Results Messages
OK
SharedArrayBuffer cloning via the Notifications API's data member: basic case FAIL assert_throws: function "() => {\n new Notification("Bob: Hi", { data: new SharedArrayBuffer() });\n }" threw object "TypeError: SharedArrayBuffer cannot be cloned in this context" that is not a DOMException DataCloneError: property "code" is equal to undefined, expected 25
SharedArrayBuffer cloning via the Notifications API's data member: is interleaved correctly FAIL assert_throws: function "() => {\n new Notification("Bob: Hi", { data: [\n { get x() { getter1Called = true; return 5; } },\n new SharedArrayBuffer(),\n { get x() { getter2Called = true; return 5; } }\n ]});\n }" threw object "TypeError: SharedArrayBuffer cannot be cloned in this context" that is not a DOMException DataCloneError: property "code" is equal to undefined, expected 25
/html/infrastructure/safe-passing-of-structured-data/shared-array-buffers/serialization-via-notifications-api.any.worker.html
Subtest Results Messages
OK
SharedArrayBuffer cloning via the Notifications API's data member: basic case FAIL assert_throws: function "() => {\n new Notification("Bob: Hi", { data: new SharedArrayBuffer() });\n }" threw object "TypeError: SharedArrayBuffer cannot be cloned in this context" that is not a DOMException DataCloneError: property "code" is equal to undefined, expected 25
SharedArrayBuffer cloning via the Notifications API's data member: is interleaved correctly FAIL assert_throws: function "() => {\n new Notification("Bob: Hi", { data: [\n { get x() { getter1Called = true; return 5; } },\n new SharedArrayBuffer(),\n { get x() { getter2Called = true; return 5; } }\n ]});\n }" threw object "TypeError: SharedArrayBuffer cannot be cloned in this context" that is not a DOMException DataCloneError: property "code" is equal to undefined, expected 25
/html/infrastructure/safe-passing-of-structured-data/shared-array-buffers/window-domain-success.sub.html
Subtest Results Messages
OK
postMessaging to a same-origin-domain (but not same-origin) iframe allows them to see each others' modifications PASS
/html/infrastructure/safe-passing-of-structured-data/shared-array-buffers/window-messagechannel-success.html
Subtest Results Messages
OK
postMessaging to a dedicated worker via MessageChannel allows them to see each others' modifications FAIL promise_test: Unhandled rejection with value: object "TypeError: SharedArrayBuffer cannot be cloned in this context"
/html/infrastructure/safe-passing-of-structured-data/shared-array-buffers/window-serviceworker-failure.https.html
Subtest Results Messages
OK
SharedArrayBuffer cannot cross agent clusters, service worker edition FAIL assert_unreached: Got an unexpected message from the service worker: worker onmessage was reached when in state "we are expecting a messageerror due to the window sending us a SAB" and data [object SharedArrayBuffer] Reached unreachable code
/html/infrastructure/safe-passing-of-structured-data/shared-array-buffers/window-sharedworker-failure.html
Subtest Results Messages
OK
SharedArrayBuffer cannot cross agent clusters, shared worker edition FAIL SharedArrayBuffer cannot be cloned in this context
/html/infrastructure/safe-passing-of-structured-data/shared-array-buffers/window-similar-but-cross-origin-success.sub.html
Subtest Results Messages
OK
postMessaging to a not same-origin-domain, but similar origin, iframe allows them to see each others' modifications PASS
/html/infrastructure/safe-passing-of-structured-data/shared-array-buffers/window-simple-success.html
Subtest Results Messages
OK
postMessaging to a dedicated worker allows them to see each others' modifications with DataView PASS
postMessaging to a dedicated worker allows them to see each others' modifications with Int8Array PASS
postMessaging to a dedicated worker allows them to see each others' modifications with Uint8Array PASS
postMessaging to a dedicated worker allows them to see each others' modifications with Uint8ClampedArray PASS
postMessaging to a dedicated worker allows them to see each others' modifications with Int16Array PASS
postMessaging to a dedicated worker allows them to see each others' modifications with Uint16Array PASS
postMessaging to a dedicated worker allows them to see each others' modifications with Int32Array PASS
postMessaging to a dedicated worker allows them to see each others' modifications with Uint32Array PASS
postMessaging to a dedicated worker allows them to see each others' modifications with Float32Array PASS
postMessaging to a dedicated worker allows them to see each others' modifications with Float64Array PASS
postMessaging to a same-origin iframe allows them to see each others' modifications PASS
postMessaging to a same-origin deeply-nested iframe allows them to see each others' modifications PASS
postMessaging to a same-origin opened window allows them to see each others' modifications PASS

@ghost
Copy link

ghost commented Feb 24, 2017

View the complete job log.

Chrome (unstable channel)

Testing web-platform-tests at revision 34ef0d4
Using browser at version 59.0.3071.25 dev
Starting 10 test iterations
All results were stable

All results

17 tests ran
/html/infrastructure/safe-passing-of-structured-data/shared-array-buffers/broadcastchannel-success-and-failure.html
Subtest Results Messages
OK
SharedArrayBuffer cannot cross agent clusters, BroadcastChannel edition FAIL SharedArrayBuffer is not defined
/html/infrastructure/safe-passing-of-structured-data/shared-array-buffers/broadcastchannel-success.html
Subtest Results Messages
OK
Structured cloning of SharedArrayBuffers: BroadcastChannel within the same agent cluster FAIL promise_test: Unhandled rejection with value: object "ReferenceError: SharedArrayBuffer is not defined"
/html/infrastructure/safe-passing-of-structured-data/shared-array-buffers/identity-not-preserved.html
Subtest Results Messages
OK
postMessaging to this window does not give back the same SharedArrayBuffer (but does use the same backing block) FAIL SharedArrayBuffer is not defined
postMessaging to a worker and back does not give back the same SharedArrayBuffer FAIL SharedArrayBuffer is not defined
postMessaging to an iframe and back does not give back the same SharedArrayBuffer FAIL SharedArrayBuffer is not defined
/html/infrastructure/safe-passing-of-structured-data/shared-array-buffers/nested-worker-success-dedicatedworker.html
Subtest Results Messages
OK
postMessaging to a dedicated sub-worker allows them to see each others' modifications FAIL Worker is not defined
/html/infrastructure/safe-passing-of-structured-data/shared-array-buffers/nested-worker-success-sharedworker.html
Subtest Results Messages
OK
postMessaging to a dedicated sub-worker allows them to see each others' modifications FAIL Worker is not defined
/html/infrastructure/safe-passing-of-structured-data/shared-array-buffers/no-transferring.html
Subtest Results Messages
OK
Trying to transfer a SharedArrayBuffer to this window throws FAIL SharedArrayBuffer is not defined
Trying to transfer a SharedArrayBuffer to a worker throws FAIL SharedArrayBuffer is not defined
Trying to transfer a SharedArrayBuffer through a MessagePort throws FAIL SharedArrayBuffer is not defined
/html/infrastructure/safe-passing-of-structured-data/shared-array-buffers/serialization-via-history.html
Subtest Results Messages
OK
history.pushState(): simple case FAIL assert_throws: function "() => {\n history[method](new SharedArrayBuffer(), "dummy title");\n }" threw object "ReferenceError: SharedArrayBuffer is not defined" that is not a DOMException DataCloneError: property "code" is equal to undefined, expected 25
history.pushState(): is interleaved correctly FAIL assert_throws: function "() => {\n history[method]([\n { get x() { getter1Called = true; return 5; } },\n new SharedArrayBuffer(),\n { get x() { getter2Called = true; return 5; } }\n ], "dummy title");\n }" threw object "ReferenceError: SharedArrayBuffer is not defined" that is not a DOMException DataCloneError: property "code" is equal to undefined, expected 25
history.replaceState(): simple case FAIL assert_throws: function "() => {\n history[method](new SharedArrayBuffer(), "dummy title");\n }" threw object "ReferenceError: SharedArrayBuffer is not defined" that is not a DOMException DataCloneError: property "code" is equal to undefined, expected 25
history.replaceState(): is interleaved correctly FAIL assert_throws: function "() => {\n history[method]([\n { get x() { getter1Called = true; return 5; } },\n new SharedArrayBuffer(),\n { get x() { getter2Called = true; return 5; } }\n ], "dummy title");\n }" threw object "ReferenceError: SharedArrayBuffer is not defined" that is not a DOMException DataCloneError: property "code" is equal to undefined, expected 25
/html/infrastructure/safe-passing-of-structured-data/shared-array-buffers/serialization-via-idb.any.worker.html
Subtest Results Messages
ERROR
/html/infrastructure/safe-passing-of-structured-data/shared-array-buffers/serialization-via-idb.any.html
Subtest Results Messages
OK
SharedArrayBuffer cloning via IndexedDB: basic case FAIL assert_throws: function "() => {\n store.put({ key: 1, property: new SharedArrayBuffer() });\n }" threw object "ReferenceError: SharedArrayBuffer is not defined" that is not a DOMException DataCloneError: property "code" is equal to undefined, expected 25
SharedArrayBuffer cloning via the IndexedDB: is interleaved correctly FAIL assert_throws: function "() => {\n store.put({ key: 1, property: [\n { get x() { getter1Called = true; return 5; } },\n new SharedArrayBuffer(),\n { get x() { getter2Called = true; return 5; } }\n ]});\n }" threw object "ReferenceError: SharedArrayBuffer is not defined" that is not a DOMException DataCloneError: property "code" is equal to undefined, expected 25
/html/infrastructure/safe-passing-of-structured-data/shared-array-buffers/serialization-via-notifications-api.any.html
Subtest Results Messages
OK
SharedArrayBuffer cloning via the Notifications API's data member: basic case FAIL assert_throws: function "() => {\n new Notification("Bob: Hi", { data: new SharedArrayBuffer() });\n }" threw object "ReferenceError: SharedArrayBuffer is not defined" that is not a DOMException DataCloneError: property "code" is equal to undefined, expected 25
SharedArrayBuffer cloning via the Notifications API's data member: is interleaved correctly FAIL assert_throws: function "() => {\n new Notification("Bob: Hi", { data: [\n { get x() { getter1Called = true; return 5; } },\n new SharedArrayBuffer(),\n { get x() { getter2Called = true; return 5; } }\n ]});\n }" threw object "ReferenceError: SharedArrayBuffer is not defined" that is not a DOMException DataCloneError: property "code" is equal to undefined, expected 25
/html/infrastructure/safe-passing-of-structured-data/shared-array-buffers/serialization-via-notifications-api.any.worker.html
Subtest Results Messages
OK
SharedArrayBuffer cloning via the Notifications API's data member: basic case FAIL assert_throws: function "() => {\n new Notification("Bob: Hi", { data: new SharedArrayBuffer() });\n }" threw object "ReferenceError: SharedArrayBuffer is not defined" that is not a DOMException DataCloneError: property "code" is equal to undefined, expected 25
SharedArrayBuffer cloning via the Notifications API's data member: is interleaved correctly FAIL assert_throws: function "() => {\n new Notification("Bob: Hi", { data: [\n { get x() { getter1Called = true; return 5; } },\n new SharedArrayBuffer(),\n { get x() { getter2Called = true; return 5; } }\n ]});\n }" threw object "ReferenceError: SharedArrayBuffer is not defined" that is not a DOMException DataCloneError: property "code" is equal to undefined, expected 25
/html/infrastructure/safe-passing-of-structured-data/shared-array-buffers/window-domain-success.sub.html
Subtest Results Messages
OK
postMessaging to a same-origin-domain (but not same-origin) iframe allows them to see each others' modifications FAIL promise_test: Unhandled rejection with value: object "ReferenceError: SharedArrayBuffer is not defined"
/html/infrastructure/safe-passing-of-structured-data/shared-array-buffers/window-messagechannel-success.html
Subtest Results Messages
OK
postMessaging to a dedicated worker via MessageChannel allows them to see each others' modifications FAIL promise_test: Unhandled rejection with value: object "ReferenceError: SharedArrayBuffer is not defined"
/html/infrastructure/safe-passing-of-structured-data/shared-array-buffers/window-serviceworker-failure.https.html
Subtest Results Messages
OK
SharedArrayBuffer cannot cross agent clusters, service worker edition FAIL SharedArrayBuffer is not defined
/html/infrastructure/safe-passing-of-structured-data/shared-array-buffers/window-sharedworker-failure.html
Subtest Results Messages
OK
SharedArrayBuffer cannot cross agent clusters, shared worker edition FAIL SharedArrayBuffer is not defined
/html/infrastructure/safe-passing-of-structured-data/shared-array-buffers/window-similar-but-cross-origin-success.sub.html
Subtest Results Messages
OK
postMessaging to a not same-origin-domain, but similar origin, iframe allows them to see each others' modifications FAIL promise_test: Unhandled rejection with value: object "ReferenceError: SharedArrayBuffer is not defined"
/html/infrastructure/safe-passing-of-structured-data/shared-array-buffers/window-simple-success.html
Subtest Results Messages
OK
postMessaging to a dedicated worker allows them to see each others' modifications with DataView FAIL promise_test: Unhandled rejection with value: object "ReferenceError: SharedArrayBuffer is not defined"
postMessaging to a dedicated worker allows them to see each others' modifications with Int8Array FAIL promise_test: Unhandled rejection with value: object "ReferenceError: SharedArrayBuffer is not defined"
postMessaging to a dedicated worker allows them to see each others' modifications with Uint8Array FAIL promise_test: Unhandled rejection with value: object "ReferenceError: SharedArrayBuffer is not defined"
postMessaging to a dedicated worker allows them to see each others' modifications with Uint8ClampedArray FAIL promise_test: Unhandled rejection with value: object "ReferenceError: SharedArrayBuffer is not defined"
postMessaging to a dedicated worker allows them to see each others' modifications with Int16Array FAIL promise_test: Unhandled rejection with value: object "ReferenceError: SharedArrayBuffer is not defined"
postMessaging to a dedicated worker allows them to see each others' modifications with Uint16Array FAIL promise_test: Unhandled rejection with value: object "ReferenceError: SharedArrayBuffer is not defined"
postMessaging to a dedicated worker allows them to see each others' modifications with Int32Array FAIL promise_test: Unhandled rejection with value: object "ReferenceError: SharedArrayBuffer is not defined"
postMessaging to a dedicated worker allows them to see each others' modifications with Uint32Array FAIL promise_test: Unhandled rejection with value: object "ReferenceError: SharedArrayBuffer is not defined"
postMessaging to a dedicated worker allows them to see each others' modifications with Float32Array FAIL promise_test: Unhandled rejection with value: object "ReferenceError: SharedArrayBuffer is not defined"
postMessaging to a dedicated worker allows them to see each others' modifications with Float64Array FAIL promise_test: Unhandled rejection with value: object "ReferenceError: SharedArrayBuffer is not defined"
postMessaging to a same-origin iframe allows them to see each others' modifications FAIL promise_test: Unhandled rejection with value: object "ReferenceError: SharedArrayBuffer is not defined"
postMessaging to a same-origin deeply-nested iframe allows them to see each others' modifications FAIL promise_test: Unhandled rejection with value: object "ReferenceError: SharedArrayBuffer is not defined"
postMessaging to a same-origin opened window allows them to see each others' modifications FAIL promise_test: Unhandled rejection with value: object "ReferenceError: SharedArrayBuffer is not defined"

@annevk annevk force-pushed the sab-structuredclone branch from 64f1136 to 6186300 Compare April 10, 2017 07:58
@annevk
Copy link
Member

annevk commented Apr 10, 2017

These tests all look good. (I rebased them across the landing of css/.)

To test the agent cluster boundary between Window objects we need #2669 fixed. But I suppose we can add a test where a Window attempts to share with a SharedWorker and vice versa. As I understand it there is supposed to be such a boundary there. For those tests I'll assume the messageerror for the receiver design, which still seems best all things considered.

@lars-t-hansen thoughts on other things to test?

@domenic
Copy link
Member Author

domenic commented Apr 13, 2017

Moved the test plan to this thread's OP. We can of course land some tests before having exhaustive tests.

domenic added a commit that referenced this pull request Apr 14, 2017
Follows whatwg/html#2530. As explained there, the circumstances in which this would actually fire are not tested in this PR, waiting instead for #5003.
domenic added a commit that referenced this pull request Apr 14, 2017
Follows whatwg/html#2530. As explained there, the circumstances in which this would actually be fired by the UA are not tested in this PR, waiting instead for #5003.

As a side effect this syncs various IDL snippets with the HTML Standard.
@domenic domenic force-pushed the sab-structuredclone branch from c17e8f6 to 6d79a36 Compare April 18, 2017 00:34
@domenic
Copy link
Member Author

domenic commented Apr 18, 2017

Tests are nearing completion (and running ahead of the spec a bit). The history/IDB/Notification tests have caught crash bugs in Chrome. In Firefox they are using TypeErrors instead of "DataCloneError" DOMExceptions; the latter seems better and is what I assume the spec will mandate.

Note that a new test reveals that both Firefox and Chrome use similar-origin, not same-origin or same-origin-domain, for agent clusters. This is as specced.

This revealed that we'll need to do some spec work for messageerror in service workers, as noted in whatwg/html#2530 (comment) .

@annevk
Copy link
Member

annevk commented Apr 18, 2017

So TypeError follows from using IDL, but I guess we can use it for StructuredSerializeForStorage too for that specific case.

@domenic
Copy link
Member Author

domenic commented Apr 18, 2017

Wait, why would it follow from IDL? history/IDB/Notifications use any; IDL won't get involved.

StructuredSerializeForStorage should do "DataCloneError" IMO.

@annevk
Copy link
Member

annevk commented Apr 18, 2017

Oops, misread. If you pass this to XHR, TextDecoder, or Blob you'll get a TypeError though, I assume.

@domenic
Copy link
Member Author

domenic commented Apr 18, 2017

Ah, yes. I hear @binji is working on tests for that as part of safelisting SAB for certain APIs. Which I still need to finish speccing, hrm.

@binji
Copy link
Contributor

binji commented Apr 18, 2017

I added a bunch of Blink layout tests to make sure the SAB typed arrays throw. Some of them use the new WPT-like testing infrastructure, so shouldn't be too hard to port, but many others use various ad-hoc testing harnesses, so might be trickier. Didn't realize someone put my name in for doing it... :-)

@domenic
Copy link
Member Author

domenic commented Apr 19, 2017

Added a BroadcastChannel test broadcasting to different iframes. In a now-familiar pattern, Firefox disallows and Chrome crashes. (It should work.)

Test using BroadcastChannel where some succeed and some fail

I'm not sure such a test is possible. To go outside the agent cluster using BroadcastChannel, we need to use shared/service workers. (BroadcastChannel doesn't work cross-origin, so windows cannot work, #2669 notwithstanding.) But it seems like BroadcastChannel only works with "suspendable workers", and I don't know how to create one of those.

@annevk
Copy link
Member

annevk commented Apr 20, 2017

@domenic you can have two same-origin Window objects that are not in the same cluster, but you need some privileged API to get that automated.

domenic added a commit that referenced this pull request Apr 20, 2017
Follows w3c/ServiceWorker#1130. The actual situations in which this will be called is being tested as part of #5003.
domenic added a commit that referenced this pull request Apr 24, 2017
Follows whatwg/html#2530. As explained there, the circumstances in which this would actually be fired by the UA are not tested in this PR, waiting instead for #5003.

As a side effect this syncs various IDL snippets with the HTML Standard.
annevk pushed a commit to whatwg/html that referenced this pull request Apr 25, 2017
Additionally, define StructuredSerializeForStorage when for
serializable objects need to be stored more persistently.

Tests: web-platform-tests/wpt#5003.

Fixes #2260 (by being the last in a set of fixes). Closes
tc39/proposal-ecmascript-sharedmem#144 and closes
tc39/proposal-ecmascript-sharedmem#65.
annevk pushed a commit to whatwg/html that referenced this pull request Apr 26, 2017
Additionally, define StructuredSerializeForStorage when for
serializable objects need to be stored more persistently.

Tests: web-platform-tests/wpt#5003.

Fixes #2260 (by being the last in a set of fixes). Closes
tc39/proposal-ecmascript-sharedmem#144 and closes
tc39/proposal-ecmascript-sharedmem#65.
@annevk
Copy link
Member

annevk commented Apr 26, 2017

Also, s/serialization-via-notifications-api.any.js/serialization-via-notifications-api-manual.any.js/ since permissions cannot be automated yet?

@ghost
Copy link

ghost commented Apr 26, 2017

View the complete job log.

Lint

Passed

@domenic
Copy link
Member Author

domenic commented Apr 26, 2017

should we s/.dedicatedworker.html/-dedicatedworker.html/ and s/.sharedworker.html/-sharedworker.html/? It seems wrong to use dots in filenames when not triggering some kind framework feature.

I've been using this for streams, but sure, I see your point. Renaming works fine.

Also, s/serialization-via-notifications-api.any.js/serialization-via-notifications-api-manual.any.js/ since permissions cannot be automated yet?

Somehow I still got these tests to crash Chrome and produce an error in Firefox in their current form. I guess because per https://notifications.spec.whatwg.org/#constructors the "create a notification" step runs before the in-parallel permission business.

BroadcastChannel that partially fails and partially succeeds

How are you sure that these two workers are "suspendable workers", per https://html.spec.whatwg.org/#dom-broadcastchannel-postmessage step 7 bullet 1 sub-bullet 2?

Assumign the test is OK, can we also test the other properties of the MessageEvent for the messageerror case?

@annevk
Copy link
Member

annevk commented Apr 26, 2017

It's not okay. I guess we can only test it once #2669 is fixed. I wonder though why BroadcastChannel basically cannot work in a shared worker. Seems like a bug of sorts.

@annevk
Copy link
Member

annevk commented Apr 26, 2017

Yeah, I think you're right that the Notification test is fine as automated, since we don't actually care about what happens with the permission thing. And spawning a permission dialog doesn't violate automation I think.

@domenic
Copy link
Member Author

domenic commented Apr 26, 2017

I can't figure out how BroadcastChannel could work in workers, basically; I don't understand what a "suspendable worker" is supposed to map to in the real world, or why you might want to broadcast to them.

@annevk
Copy link
Member

annevk commented Apr 26, 2017

I went digging, it was a typo that was introduced when this feature was added. Compare https://www.w3.org/Bugs/Public/show_bug.cgi?id=24414 with whatwg/html@300e7de.

@annevk
Copy link
Member

annevk commented Apr 27, 2017

We now have limited coverage for all different views as well, including DataView, and including that they're successfully "cloning" their backing shared buffer.

@ghost
Copy link

ghost commented Apr 27, 2017

These tests are now available on w3c-test.org

@domenic
Copy link
Member Author

domenic commented Apr 27, 2017

This LGTM to merge and file bugs.

@annevk annevk merged commit 6dbe096 into master Apr 28, 2017
@annevk annevk deleted the sab-structuredclone branch April 28, 2017 04:42
annevk added a commit to whatwg/html that referenced this pull request Apr 28, 2017
Additionally, define StructuredSerializeForStorage when for
serializable objects need to be stored more persistently.

Tests: web-platform-tests/wpt#5003.

StructuredSerializeForStorage follow-up:

* whatwg/notifications#99
* w3c/IndexedDB#197

Fixes #2260 (by being the last in a set of fixes). Closes
tc39/proposal-ecmascript-sharedmem#144 and closes
tc39/proposal-ecmascript-sharedmem#65.
domenic added a commit that referenced this pull request May 1, 2017
Follows w3c/ServiceWorker#1130. The actual situations in which this will be called is being tested as part of #5003.
inikulin pushed a commit to HTMLParseErrorWG/html that referenced this pull request May 9, 2017
Additionally, define StructuredSerializeForStorage when for
serializable objects need to be stored more persistently.

Tests: web-platform-tests/wpt#5003.

StructuredSerializeForStorage follow-up:

* whatwg/notifications#99
* w3c/IndexedDB#197

Fixes whatwg#2260 (by being the last in a set of fixes). Closes
tc39/proposal-ecmascript-sharedmem#144 and closes
tc39/proposal-ecmascript-sharedmem#65.
inikulin pushed a commit to HTMLParseErrorWG/html that referenced this pull request May 9, 2017
Additionally, define StructuredSerializeForStorage when for
serializable objects need to be stored more persistently.

Tests: web-platform-tests/wpt#5003.

StructuredSerializeForStorage follow-up:

* whatwg/notifications#99
* w3c/IndexedDB#197

Fixes whatwg#2260 (by being the last in a set of fixes). Closes
tc39/proposal-ecmascript-sharedmem#144 and closes
tc39/proposal-ecmascript-sharedmem#65.
alice pushed a commit to alice/html that referenced this pull request Jan 8, 2019
Additionally, define StructuredSerializeForStorage when for
serializable objects need to be stored more persistently.

Tests: web-platform-tests/wpt#5003.

StructuredSerializeForStorage follow-up:

* whatwg/notifications#99
* w3c/IndexedDB#197

Fixes whatwg#2260 (by being the last in a set of fixes). Closes
tc39/proposal-ecmascript-sharedmem#144 and closes
tc39/proposal-ecmascript-sharedmem#65.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants