Closed Bug 1625877 Opened 5 years ago Closed 5 years ago

Error on postMessage() of SharedArrayBuffer to WebWorker

Categories

(Core :: JavaScript Engine, defect)

74 Branch
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 1477743

People

(Reporter: morten.sorvig, Unassigned)

Details

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_4) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1 Safari/605.1.15

Steps to reproduce:

Sending a SharedArrayBuffer to a WebWorker via postMessage() does not seem to work in recent Firefox release versions - is it supposed to?

I'm setting headers as described in: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer/Planned_changes

HTTP/1.0 200 OK
Server: SimpleHTTP/0.6 Python/3.7.7
Date: Mon, 30 Mar 2020 09:28:20 GMT
Content-type: application/javascript
Content-Length: 294
Last-Modified: Mon, 30 Mar 2020 08:38:13 GMT
Cross-Origin-Opener-Policy: same-origin
Cross-Origin-Embedder-Policy: require-corp
Cross-Origin-Resource-Policy: cross-origin

The error can be reproduced using demo code from https://github.com/rauschma/shared-array-buffer-demo. The lines that throw the errors are:

sharedBuffer = new SharedArrayBuffer(1 * Int32Array.BYTES_PER_ELEMENT);
worker.postMessage({sharedBuffer});

(The demo works in Chrome and FireFox nightly)

Actual results:

TypeError: The SharedArrayBuffer object cannot be serialized. The Cross-Origin-Opener-Policy and Cross-Origin-Embedder-Policy HTTP headers will enable this in the future.

Expected results:

No errors

Hello! I wasn't able to reproduce with the files provided in the description in Fx 76.0a1(2020-03-04) and neither with Fx 74.0 on MacOS 10.15.4. On Firefox 74.0 on loading the html file I get a message in the page that That browser does not support SharedArrayBuffers! but no errors in the web console, and on Fx 76.0a1(2020-03-04) I got an error in the web console Shared memory objects must not be in the transfer list. I will set a component for this issue so one of our developers could look more into it, if it's not the right component please feel free to change it to an appropriate one.

Component: Untriaged → JavaScript Engine
Product: Firefox → Core

(In reply to morten.sorvig from comment #0)

Sending a SharedArrayBuffer to a WebWorker via postMessage() does not seem to work in recent Firefox release versions - is it supposed to?

It is not currently supposed to work. This is a temporary constraint. cc'ing Anne, he can explain this in more detail.

Flags: needinfo?(annevk)

See bug 1619649 and its dependencies for what still needs to be done. Once that's all covered and has agreement, this will ride to release.

Status: UNCONFIRMED → RESOLVED
Closed: 5 years ago
Flags: needinfo?(annevk)
Resolution: --- → DUPLICATE

Thanks for the reply, will keep track of 1619649.

You need to log in before you can comment on or make changes to this bug.