mirror of
https://github.com/servo/servo.git
synced 2025-08-12 08:55:32 +01:00
Auto merge of #25796 - gterzian:implement_broadcast_channel, r=Manishearth
Implement Broadcastchannel <!-- Please describe your changes on the following line: --> FIX #21025 --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [ ] `./mach build -d` does not report any errors - [ ] `./mach test-tidy` does not report any errors - [ ] These changes fix #___ (GitHub issue number if applicable) <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because ___ <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
This commit is contained in:
commit
c9c5f8b9e5
35 changed files with 779 additions and 224 deletions
|
@ -550029,7 +550029,7 @@
|
|||
],
|
||||
"broadcastchannel": {
|
||||
"basics.html": [
|
||||
"ed16e32f5437dc430b5cc11b967e6538ef6cf393",
|
||||
"3d8ba76fb1ba35658c44702059925fe53e3fb6f6",
|
||||
[
|
||||
null,
|
||||
{}
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
[noopener-noreferrer-BarProp.window.html]
|
||||
expected: TIMEOUT
|
||||
[window.open() with noopener should have all bars visible]
|
||||
expected: FAIL
|
||||
expected: TIMEOUT
|
||||
|
||||
[All bars visible]
|
||||
expected: FAIL
|
||||
|
||||
[window.open() with noreferrer should have all bars visible]
|
||||
expected: FAIL
|
||||
expected: TIMEOUT
|
||||
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
[noopener-noreferrer-sizing.window.html]
|
||||
[window.open() with noreferrer should have equal viewport width and height]
|
||||
expected: FAIL
|
||||
|
||||
[window.open() with noopener should have equal viewport width and height]
|
||||
expected: FAIL
|
||||
|
|
@ -36,7 +36,6 @@
|
|||
|
||||
|
||||
[window-open-noopener.html?indexed]
|
||||
expected: ERROR
|
||||
[window.open() with 'noopener' should not reuse existing target]
|
||||
expected: FAIL
|
||||
|
||||
|
@ -49,30 +48,6 @@
|
|||
[noopener needs to be present as a token on its own yet again]
|
||||
expected: NOTRUN
|
||||
|
||||
[Trailing noopener should work]
|
||||
expected: NOTRUN
|
||||
|
||||
[Leading noopener should work]
|
||||
expected: NOTRUN
|
||||
|
||||
[Interior noopener should work]
|
||||
expected: NOTRUN
|
||||
|
||||
[noopener=1 means the same as noopener]
|
||||
expected: NOTRUN
|
||||
|
||||
[noopener=0 means lack of noopener]
|
||||
expected: NOTRUN
|
||||
|
||||
[noopener separated only by spaces should work]
|
||||
expected: NOTRUN
|
||||
|
||||
[window.open() with 'noopener' should reuse existing target]
|
||||
expected: FAIL
|
||||
|
||||
[noreferrer should also suppress opener when reusing existing target]
|
||||
expected: NOTRUN
|
||||
|
||||
|
||||
[window-open-noopener.html?_self]
|
||||
[noopener window.open targeting _self]
|
||||
|
|
|
@ -1,4 +0,0 @@
|
|||
[window-open-noreferrer.html]
|
||||
[window.open() with "noreferrer" tests]
|
||||
expected: FAIL
|
||||
|
|
@ -332,18 +332,12 @@
|
|||
[CanvasRenderingContext2D interface: operation scrollPathIntoView(Path2D)]
|
||||
expected: FAIL
|
||||
|
||||
[BroadcastChannel interface: attribute name]
|
||||
expected: FAIL
|
||||
|
||||
[ApplicationCache interface object name]
|
||||
expected: FAIL
|
||||
|
||||
[DOMStringList interface: calling item(unsigned long) on location.ancestorOrigins with too few arguments must throw TypeError]
|
||||
expected: FAIL
|
||||
|
||||
[BroadcastChannel interface: existence and properties of interface prototype object's "constructor" property]
|
||||
expected: FAIL
|
||||
|
||||
[BarProp interface object length]
|
||||
expected: FAIL
|
||||
|
||||
|
@ -704,9 +698,6 @@
|
|||
[OffscreenCanvasRenderingContext2D interface object name]
|
||||
expected: FAIL
|
||||
|
||||
[BroadcastChannel interface: attribute onmessage]
|
||||
expected: FAIL
|
||||
|
||||
[ElementInternals interface object name]
|
||||
expected: FAIL
|
||||
|
||||
|
@ -800,9 +791,6 @@
|
|||
[ApplicationCache interface: attribute onerror]
|
||||
expected: FAIL
|
||||
|
||||
[BroadcastChannel interface: existence and properties of interface object]
|
||||
expected: FAIL
|
||||
|
||||
[SVGElement interface: attribute onsubmit]
|
||||
expected: FAIL
|
||||
|
||||
|
@ -968,9 +956,6 @@
|
|||
[SVGElement interface: attribute onkeydown]
|
||||
expected: FAIL
|
||||
|
||||
[BroadcastChannel interface: existence and properties of interface prototype object's @@unscopables property]
|
||||
expected: FAIL
|
||||
|
||||
[Path2D interface: existence and properties of interface prototype object's "constructor" property]
|
||||
expected: FAIL
|
||||
|
||||
|
@ -1067,9 +1052,6 @@
|
|||
[OffscreenCanvas interface object name]
|
||||
expected: FAIL
|
||||
|
||||
[BroadcastChannel interface: operation close()]
|
||||
expected: FAIL
|
||||
|
||||
[SVGElement interface: attribute onresize]
|
||||
expected: FAIL
|
||||
|
||||
|
@ -1166,9 +1148,6 @@
|
|||
[ImageBitmap interface: attribute width]
|
||||
expected: FAIL
|
||||
|
||||
[BroadcastChannel interface: operation postMessage(any)]
|
||||
expected: FAIL
|
||||
|
||||
[DataTransfer interface: attribute types]
|
||||
expected: FAIL
|
||||
|
||||
|
@ -1214,18 +1193,12 @@
|
|||
[SVGElement interface: attribute onvolumechange]
|
||||
expected: FAIL
|
||||
|
||||
[BroadcastChannel interface object name]
|
||||
expected: FAIL
|
||||
|
||||
[CanvasRenderingContext2D interface: attribute textBaseline]
|
||||
expected: FAIL
|
||||
|
||||
[ImageBitmapRenderingContext interface object length]
|
||||
expected: FAIL
|
||||
|
||||
[BroadcastChannel interface: existence and properties of interface prototype object]
|
||||
expected: FAIL
|
||||
|
||||
[Path2D interface: operation addPath(Path2D, DOMMatrix2DInit)]
|
||||
expected: FAIL
|
||||
|
||||
|
@ -1307,9 +1280,6 @@
|
|||
[CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "scrollPathIntoView()" with the proper type]
|
||||
expected: FAIL
|
||||
|
||||
[BroadcastChannel interface: attribute onmessageerror]
|
||||
expected: FAIL
|
||||
|
||||
[OffscreenCanvas interface: operation convertToBlob(ImageEncodeOptions)]
|
||||
expected: FAIL
|
||||
|
||||
|
@ -1331,9 +1301,6 @@
|
|||
[ValidityState interface: document.createElement("input").validity must inherit property "valid" with the proper type]
|
||||
expected: FAIL
|
||||
|
||||
[BroadcastChannel interface object length]
|
||||
expected: FAIL
|
||||
|
||||
[Location interface: stringifier]
|
||||
expected: FAIL
|
||||
|
||||
|
@ -4442,4 +4409,3 @@
|
|||
|
||||
[HTMLImageElement interface: document.createElement("img") must inherit property "loading" with the proper type]
|
||||
expected: FAIL
|
||||
|
||||
|
|
|
@ -1,15 +1,9 @@
|
|||
[no-coop-coep.https.any.worker.html]
|
||||
[SharedArrayBuffer over BroadcastChannel without COOP+COEP]
|
||||
expected: FAIL
|
||||
|
||||
[Bonus: self.crossOriginIsolated]
|
||||
expected: FAIL
|
||||
|
||||
|
||||
[no-coop-coep.https.any.html]
|
||||
[SharedArrayBuffer over BroadcastChannel without COOP+COEP]
|
||||
expected: FAIL
|
||||
|
||||
[Bonus: self.crossOriginIsolated]
|
||||
expected: FAIL
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
[rel-base-target.html]
|
||||
expected: TIMEOUT
|
||||
[<form rel="noreferrer opener"> with <base target>]
|
||||
expected: FAIL
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
[htmlanchorelement_noopener.html]
|
||||
type: testharness
|
||||
expected: ERROR
|
||||
[Check that targeting of rel=noopener with a given name ignores an existing window with that name]
|
||||
expected: NOTRUN
|
||||
|
||||
|
@ -11,7 +10,7 @@
|
|||
expected: FAIL
|
||||
|
||||
[Check that targeting of rel=noopener with a given name reuses an existing window with that name]
|
||||
expected: NOTRUN
|
||||
expected: FAIL
|
||||
|
||||
[Check that rel=noopener with target=_self does a normal load]
|
||||
expected: FAIL
|
||||
|
|
|
@ -1,40 +1,20 @@
|
|||
[target_blank_implicit_noopener.html]
|
||||
[Anchor element with target=_blank with rel=opener+noopener]
|
||||
expected: FAIL
|
||||
|
||||
expected: TIMEOUT
|
||||
[Area element with target=_blank with rel=opener+noopener]
|
||||
expected: FAIL
|
||||
|
||||
[Anchor element with target=_blank with rel=noopener+opener+noreferrer]
|
||||
expected: FAIL
|
||||
|
||||
[Anchor element with target=_blank with rel=opener]
|
||||
expected: FAIL
|
||||
|
||||
[Anchor element with target=_blank with rel=noopener+opener]
|
||||
expected: FAIL
|
||||
expected: TIMEOUT
|
||||
|
||||
[Area element with target=_blank with rel=noopener]
|
||||
expected: FAIL
|
||||
expected: TIMEOUT
|
||||
|
||||
[Area element with target=_blank with rel=opener]
|
||||
expected: FAIL
|
||||
expected: TIMEOUT
|
||||
|
||||
[Anchor element with target=_blank with implicit rel=noopener]
|
||||
expected: FAIL
|
||||
|
||||
[Anchor element with target=_blank with rel=opener+noreferrer]
|
||||
expected: FAIL
|
||||
|
||||
[Area element with target=_blank with implicit rel=noopener]
|
||||
expected: FAIL
|
||||
|
||||
[Anchor element with target=_blank with rel=noreferrer]
|
||||
expected: FAIL
|
||||
expected: TIMEOUT
|
||||
|
||||
[Area element with target=_blank with rel=noopener+opener]
|
||||
expected: FAIL
|
||||
|
||||
[Anchor element with target=_blank with rel=noopener]
|
||||
expected: FAIL
|
||||
expected: TIMEOUT
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
[target_blank_implicit_noopener_base.html]
|
||||
expected: TIMEOUT
|
||||
[Anchor element with base target=_blank with implicit rel=noopener]
|
||||
expected: FAIL
|
||||
|
||||
|
|
|
@ -1,4 +0,0 @@
|
|||
[MessageEvent-trusted.html]
|
||||
[With a BroadcastChannel]
|
||||
expected: FAIL
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
[basics.html]
|
||||
[messages are delivered in port creation order]
|
||||
expected: FAIL
|
||||
|
||||
[closing and creating channels during message delivery works correctly]
|
||||
expected: FAIL
|
||||
|
||||
[messages aren't delivered to a closed port]
|
||||
expected: FAIL
|
||||
|
||||
[Closing a channel in onmessage doesn't cancel already queued events]
|
||||
expected: FAIL
|
||||
|
||||
[postMessage results in correct event]
|
||||
expected: FAIL
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
[blobs.html]
|
||||
[Blobs work with workers on BroadcastChannel]
|
||||
expected: FAIL
|
||||
|
||||
[Blobs work on BroadcastChannel]
|
||||
expected: FAIL
|
||||
|
|
@ -1,40 +0,0 @@
|
|||
[interface.html]
|
||||
[Null name should not throw]
|
||||
expected: FAIL
|
||||
|
||||
[postMessage after close should throw]
|
||||
expected: FAIL
|
||||
|
||||
[Undefined name should not throw]
|
||||
expected: FAIL
|
||||
|
||||
[postMessage should throw with uncloneable data]
|
||||
expected: FAIL
|
||||
|
||||
[close should not throw when called multiple times]
|
||||
expected: FAIL
|
||||
|
||||
[close should not throw]
|
||||
expected: FAIL
|
||||
|
||||
[Non-empty name should not throw]
|
||||
expected: FAIL
|
||||
|
||||
[postMessage with null should not throw]
|
||||
expected: FAIL
|
||||
|
||||
[postMessage should throw InvalidStateError after close, even with uncloneable data]
|
||||
expected: FAIL
|
||||
|
||||
[BroadcastChannel should have an onmessage event]
|
||||
expected: FAIL
|
||||
|
||||
[Non-string name should not throw]
|
||||
expected: FAIL
|
||||
|
||||
[Should throw if no name is provided]
|
||||
expected: FAIL
|
||||
|
||||
[postMessage without parameters should throw]
|
||||
expected: FAIL
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
[origin.window.html]
|
||||
expected: TIMEOUT
|
||||
[Serialization of BroadcastChannel origin]
|
||||
expected: TIMEOUT
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
[sandbox.html]
|
||||
[Creating BroadcastChannel in an opaque origin]
|
||||
expected: FAIL
|
||||
|
|
@ -1,17 +1,4 @@
|
|||
[workers.html]
|
||||
expected: TIMEOUT
|
||||
[BroadcastChannel used after a worker self.close()]
|
||||
expected: FAIL
|
||||
|
||||
[BroadcastChannel works in shared workers]
|
||||
expected: FAIL
|
||||
|
||||
[BroadcastChannel works in workers]
|
||||
expected: FAIL
|
||||
|
||||
[BroadcastChannel created after a worker self.close()]
|
||||
expected: TIMEOUT
|
||||
|
||||
[Closing and re-opening a channel works.]
|
||||
expected: FAIL
|
||||
|
||||
|
|
|
@ -8,7 +8,3 @@
|
|||
|
||||
[Worker has an opaque origin.]
|
||||
expected: FAIL
|
||||
|
||||
[Worker can access BroadcastChannel]
|
||||
expected: FAIL
|
||||
|
||||
|
|
|
@ -12,9 +12,6 @@
|
|||
[The Path2D interface object should be exposed.]
|
||||
expected: FAIL
|
||||
|
||||
[The BroadcastChannel interface object should be exposed.]
|
||||
expected: FAIL
|
||||
|
||||
[The ReadableStream interface object should be exposed.]
|
||||
expected: FAIL
|
||||
|
||||
|
@ -59,3 +56,4 @@
|
|||
|
||||
[The IDBTransaction interface object should be exposed.]
|
||||
expected: FAIL
|
||||
|
||||
|
|
|
@ -10971,7 +10971,7 @@
|
|||
[]
|
||||
],
|
||||
"interfaces.js": [
|
||||
"c46c336f8a8a2db777f75d6236b1241c717a02dd",
|
||||
"689016240d603459ee1b633a5e80009291376396",
|
||||
[]
|
||||
],
|
||||
"nested_asap_script.js": [
|
||||
|
@ -13863,14 +13863,14 @@
|
|||
]
|
||||
],
|
||||
"interfaces.html": [
|
||||
"163ab416b1627e07347b83aa210712364182343a",
|
||||
"12f1d0b7f17be6575d4527423aed0ec845c4c2d5",
|
||||
[
|
||||
null,
|
||||
{}
|
||||
]
|
||||
],
|
||||
"interfaces.worker.js": [
|
||||
"3f77783a6cc31e7803dd61873ba17c92ce12eccc",
|
||||
"c1223084790b2980c8184e3cd9ab5ae17bc8b303",
|
||||
[
|
||||
"mozilla/interfaces.worker.html",
|
||||
{}
|
||||
|
|
|
@ -28,6 +28,7 @@ test_interfaces([
|
|||
"BeforeUnloadEvent",
|
||||
"BiquadFilterNode",
|
||||
"Blob",
|
||||
"BroadcastChannel",
|
||||
"CanvasGradient",
|
||||
"CanvasRenderingContext2D",
|
||||
"CanvasPattern",
|
||||
|
|
|
@ -7,6 +7,7 @@ function test_interfaces(interfaceNamesInGlobalScope) {
|
|||
"ArrayBuffer",
|
||||
"Atomics",
|
||||
"Boolean",
|
||||
"BroadcastChannel",
|
||||
"Crypto",
|
||||
"DataView",
|
||||
"Date",
|
||||
|
|
|
@ -8,6 +8,7 @@ importScripts("interfaces.js");
|
|||
// IMPORTANT: Do not change the list below without review from a DOM peer!
|
||||
test_interfaces([
|
||||
"Blob",
|
||||
"BroadcastChannel",
|
||||
"CanvasGradient",
|
||||
"CanvasPattern",
|
||||
"CloseEvent",
|
||||
|
|
|
@ -69,6 +69,17 @@ async_test(t => {
|
|||
c1.postMessage('test');
|
||||
}, 'messages aren\'t delivered to a closed port');
|
||||
|
||||
async_test(t => {
|
||||
let c1 = new BroadcastChannel('closed');
|
||||
let c2 = new BroadcastChannel('closed');
|
||||
let c3 = new BroadcastChannel('closed');
|
||||
|
||||
c2.onmessage = t.unreached_func();
|
||||
c3.onmessage = t.step_func(() => t.done());
|
||||
c1.postMessage('test');
|
||||
c2.close();
|
||||
}, 'messages aren\'t delivered to a port closed after calling postMessage.');
|
||||
|
||||
async_test(t => {
|
||||
let c1 = new BroadcastChannel('create-in-onmessage');
|
||||
let c2 = new BroadcastChannel('create-in-onmessage');
|
||||
|
@ -87,8 +98,6 @@ async_test(t => {
|
|||
c2.postMessage('second');
|
||||
}, 'closing and creating channels during message delivery works correctly');
|
||||
|
||||
// TODO(mek): Depending on https://github.com/whatwg/html/issues/1371 adjust
|
||||
// this test to match the correct behavior.
|
||||
async_test(t => {
|
||||
let c1 = new BroadcastChannel('close-in-onmessage');
|
||||
let c2 = new BroadcastChannel('close-in-onmessage');
|
||||
|
@ -108,13 +117,12 @@ async_test(t => {
|
|||
assert_array_equals(events, [
|
||||
'c2: first',
|
||||
'c3: first',
|
||||
'c2: done',
|
||||
'c3: done']);
|
||||
t.done();
|
||||
}
|
||||
}));
|
||||
c1.postMessage('first');
|
||||
c1.postMessage('done');
|
||||
}, 'Closing a channel in onmessage doesn\'t cancel already queued events');
|
||||
}, 'Closing a channel in onmessage prevents already queued tasks from firing onmessage events');
|
||||
|
||||
</script>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue