-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
HTML: BroadcastChannel and SharedArrayBuffer success case revamp
The original test could not work. This should be able to work and also adds COOP/COEP headers for future proofing. No browser passes still. For whatwg/html#4734.
- Loading branch information
Showing
4 changed files
with
16 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,30 +6,27 @@ | |
<link rel="author" title="Domenic Denicola" href="mailto:[email protected]"> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script src="/common/utils.js"></script> <!-- Use token() to allow running tests in parallel --> | ||
|
||
<div id="log"></div> | ||
|
||
<script> | ||
"use strict"; | ||
|
||
promise_test(t => { | ||
const channelName = token(); | ||
return Promise.all([ | ||
createIFrame("resources/broadcastchannel-iframe.html"), | ||
createIFrame("resources/broadcastchannel-iframe.html"), | ||
createIFrame("resources/broadcastchannel-iframe.html") | ||
createIFrame(`resources/broadcastchannel-iframe.html?channel=${channelName}&index=0`), | ||
createIFrame(`resources/broadcastchannel-iframe.html?channel=${channelName}&index=1`), | ||
createIFrame(`resources/broadcastchannel-iframe.html?channel=${channelName}&index=2`) | ||
]).then(() => { | ||
const sab = new SharedArrayBuffer(3); | ||
const view = new Uint8Array(sab); | ||
const channel = new BroadcastChannel("channel name"); | ||
const channel = new BroadcastChannel(channelName); | ||
|
||
return new Promise(resolve => { | ||
let soFar = 0; | ||
channel.onmessage = t.step_func(({ data: { sab: broadcastSAB, i } }) => { | ||
if (broadcastSAB) { | ||
// We only care about "broadcasts" from the workers. | ||
return; | ||
} | ||
|
||
channel.onmessage = t.step_func(({ data: { i } }) => { | ||
assert_in_array(i, [0, 1, 2], "Any message events must come from expected sources"); | ||
++soFar; | ||
|
||
|
2 changes: 2 additions & 0 deletions
2
...ssing-of-structured-data/shared-array-buffers/broadcastchannel-success.https.html.headers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Cross-Origin-Opener-Policy: same-origin | ||
Cross-Origin-Embedder-Policy: require-corp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
...ng-of-structured-data/shared-array-buffers/resources/broadcastchannel-iframe.html.headers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Cross-Origin-Embedder-Policy: require-corp |