SharedWorker does not provide SharedArrayBuffer
Categories
(Core :: DOM: Workers, defect, P3)
Tracking
()
People
(Reporter: sberg.fun, Unassigned)
References
(Depends on 1 open bug, Blocks 1 open bug)
Details
Steps to reproduce:
As originally asked about at https://discourse.mozilla.org/t/support-for-sharedarraybuffer-in-sharedworker/145358 "Support for SharedArrayBuffer in SharedWorker?": When serving content with Cross-Origin-Opener-Policy: same-origin
and Cross-Origin-Embedder-Policy: require-corp
, a SharedWorker
does not provide SharedArrayBuffer
, and while it allows to create a shared WebAssembly.Memory
, that is effectively useless, as that memory object cannot be passed over a channel.
Consider test.js
console.log('test 1:');
console.assert(typeof SharedArrayBuffer !== 'undefined');
console.log('test 2:');
const mem = new WebAssembly.Memory({initial: 1, maximum: 1, shared: true});
const ch = new MessageChannel();
try {
ch.port1.postMessage(mem);
} catch (e) {
console.error(e);
}
console.log('done');
and the two scenarios window.html
<html>
<body>
<script type="text/javascript" src="test.js"></script>
</body>
</html>
and sharedworker.html
<html>
<body>
<script type="text/javascript">
new SharedWorker('test.js');
</script>
</body>
</html>
Actual results:
While window.html
succeeds, sharedworker.html
fails with
test 1: test.js:1:9
Assertion failed: test.js:2:9
test 2: test.js:3:9
Error: undefined test.js:9:10
<anonymous> http://localhost:6931/test.js:9
done test.js:11:9
Expected results:
When setting dom.postMessage.sharedArrayBuffer.bypassCOOP_COEP.insecure.enabled
to true
(which can only be done in Nightly), sharedworker.html
succeeds as well with
test 1: test.js:1:9
test 2: test.js:3:9
done test.js:11:9
Comment 1•28 days ago
|
||
The Bugbug bot thinks this bug should belong to the 'Core::JavaScript: WebAssembly' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.
Updated•26 days ago
|
Updated•25 days ago
|
Updated•25 days ago
|
Comment 2•24 days ago
|
||
The component has been changed since the backlog priority was decided, so we're resetting it.
For more information, please visit BugBot documentation.
Updated•24 days ago
|
Description
•