Bug 183082 - Can't transfer arraybuffer to service worker
Summary: Can't transfer arraybuffer to service worker
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Service Workers (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
Keywords: InRadar
Depends on:
Reported: 2018-02-23 06:52 PST by Ms2ger (he/him; ⌚ UTC+1/+2)
Modified: 2018-02-23 08:50 PST (History)
5 users (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Ms2ger (he/him; ⌚ UTC+1/+2) 2018-02-23 06:52:44 PST
Problem seems to be that MessageWithMessagePorts::{encode,decode} don't handle the transferred array buffers, only the serialization and MessagePorts.

Test case:

<!doctype html>
<script src=/resources/testharness.js>
promise_test(async t => {
  let reg = await navigator.serviceWorker.register("/tmp/sw.js");
  const ab = new ArrayBuffer(8);
  let sw = reg.installing || reg.waiting || reg.active;
  sw.postMessage(ab, [ab]);
  await new Promise((res, rej) => {
    navigator.serviceWorker.onmessage = e => rej(e.data);

self.addEventListener('message', function(event) {
Comment 1 Radar WebKit Bug Importer 2018-02-23 07:25:44 PST