structuredClone should not clone SharedArrayBuffer if not cross-origin isolated
Categories
(Core :: DOM: postMessage, defect, P3)
Tracking
()
Tracking | Status | |
---|---|---|
firefox103 | --- | fixed |
People
(Reporter: valentinium, Assigned: evilpie)
Details
Attachments
(1 file)
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.4959.0 Safari/537.36
Steps to reproduce:
let { SharedArrayBuffer=sayTheLineBart() } = globalThis;
console.assert(crossOriginIsolated === false, "Specific to non-isolated");
try {
structuredClone(new SharedArrayBuffer(1));
console.assert(false, "Shouldn’t clone SAB at all without cross-origin isolation.");
} catch (err) {
console.assert(err.code === DOMException.DATA_CLONE_ERR, "Should throw DataCloneError");
}
function sayTheLineBart() {
return new WebAssembly.Memory({
initial: 0,
maximum: 0,
shared: 1
}).buffer.constructor;
}
Actual results:
SharedArrayBuffer is cloned successfully in a non cross-origin isolated env.
Expected results:
DataCloneError should be thrown.
Verified that the current behavior specified by HTML is by design (https://github.com/whatwg/html/issues/7781) because the Firefox behavior is arguably just trying to be “smarter” (i.e., since it’s known to be safe here). Consistency would still be best.
Comment 1•2 years ago
|
||
The Bugbug bot thinks this bug should belong to the 'Core::DOM: Core & HTML' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.
Updated•2 years ago
|
Updated•2 years ago
|
Comment 2•2 years ago
|
||
Tom, want to take a look? This should be just some missing flag or such.
Comment 3•2 years ago
|
||
(I believe Eden will be on leave for awhile.)
Assignee | ||
Updated•2 years ago
|
Assignee | ||
Comment 4•2 years ago
|
||
Assignee | ||
Updated•2 years ago
|
Pushed by nfay@mozilla.com: https://hg.mozilla.org/mozilla-central/rev/28ecef349562 structuredClone should not always allow cloning SharedArrayBuffers. r=smaug
Comment 6•2 years ago
|
||
bugherder |
Description
•