Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Intent to ship: Atomics and SharedArrayBuffer objects (limited to a single thread)

64 views
Skip to first unread message

Tom Tung

unread,
Mar 30, 2020, 7:19:41 AM3/30/20
to dev-pl...@lists.mozilla.org
Hi,


Planned for Firefox 78.

Summary: This is a small but important step in returning shared memory
support to the web. The postMessage() API throws and will continue to throw
when given a SharedArrayBuffer object so this specific change does not give
developers shared memory, but it does return the Atomics API and
WebAssembly.Memory({ shared:true, … }). Because of web compatibility
concern raised by the V8 team, globalThis.SharedArrayBuffer will for now
return undefined, but globalThis.SAB = new WebAssembly.Memory({
shared:true, initial:0, maximum: 0 }).buffer.constructor can be used as
workaround.

I.e., this is step 2 of “Intent to prototype: re-enabling
SharedArrayBuffer”. [1] We’re still working on finalizing the
Cross-Origin-Opener-Policy and Cross-Origin-Embedder-Policy implementation
and hope to have those ready soonish. [2] When ready, and when set by
developers, those will enable postMessage() to function and make
globalThis.SharedArrayBuffer available. [3]

Risk: This change baked on early beta and earlier since Firefox 74 and no
bugs have been reported. [4] That coupled with globalThis.SharedArrayBuffer
now being hidden makes the risk minimal.

Other UAs shipping this feature: Chrome currently ships these features
without restriction, but as indicated in [3] and as can be seen from recent
blink-dev activity and input from the V8 team they plan to align on this
model.

Bug to turn on by default:
https://bugzilla.mozilla.org/show_bug.cgi?id=1606624

Platform coverage: All.

[1]
https://groups.google.com/d/msg/mozilla.dev.platform/IHkBZlHETpA/dwsMNchWEQAJ

[2] https://bugzilla.mozilla.org/show_bug.cgi?id=1477743

[3]
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer/Planned_changes
[4] https://bugzilla.mozilla.org/show_bug.cgi?id=1599496


Thanks,

Tom
0 new messages