-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 1633475 [wpt PR 23270] - Test that postMessage doesn't block on e…
…vent loop, a=testonly Automatic update from web-platform-tests Test that postMessage doesn't block on event loop Per spec postMessage should queue a message up on the target port immediately. Instead, when Workers are involved, some implementations queue a task up on current thread's event loop, which means that in case it gets blocked, some messages are never sent. Closes whatwg/html#5485. -- wpt-commits: 3320205a9d70636efc03cfff340edecd0bee4694 wpt-pr: 23270
- Loading branch information
1 parent
370b040
commit d139adb
Showing
4 changed files
with
23 additions
and
0 deletions.
There are no files selected for viewing
18 changes: 18 additions & 0 deletions
18
testing/web-platform/tests/workers/postMessage_block.https.html
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,18 @@ | ||
<!DOCTYPE html> | ||
<meta charset=utf-8> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<body> | ||
<script> | ||
const t = async_test('postMessage and block'); | ||
|
||
const w = new Worker('support/postMessage_block_worker.js'); | ||
|
||
w.onmessage = t.step_func_done(() => { | ||
const a = new Int32Array(new SharedArrayBuffer(4)); | ||
w.postMessage(a); | ||
while (Atomics.load(a, 0) === 0); | ||
assert_equals(Atomics.load(a, 0), 1); | ||
}); | ||
</script> | ||
</body> |
2 changes: 2 additions & 0 deletions
2
testing/web-platform/tests/workers/postMessage_block.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 |
2 changes: 2 additions & 0 deletions
2
testing/web-platform/tests/workers/support/postMessage_block_worker.js
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 @@ | ||
onmessage = e => Atomics.store(e.data, 0, 1); | ||
postMessage('ready'); |
1 change: 1 addition & 0 deletions
1
testing/web-platform/tests/workers/support/postMessage_block_worker.js.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 |