diff options
author | Leo K <crowlkats@toaxl.com> | 2021-08-09 10:39:00 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-09 10:39:00 +0200 |
commit | 16ae4a0d5799c9a4ed776f32929f73b1063ae4e8 (patch) | |
tree | ed5d0def5e0acbf67f2c64ac4664b1af46f4c468 /runtime/js | |
parent | 02c74fb70970fcadb7d1e6dab857eeb2cea20e09 (diff) |
feat(extensions/web): add structuredClone function (#11572)
Co-authored-by: Luca Casonato <hello@lcas.dev>
Diffstat (limited to 'runtime/js')
-rw-r--r-- | runtime/js/11_workers.js | 11 | ||||
-rw-r--r-- | runtime/js/99_main.js | 12 |
2 files changed, 15 insertions, 8 deletions
diff --git a/runtime/js/11_workers.js b/runtime/js/11_workers.js index 38267f571..b5a8a9d0c 100644 --- a/runtime/js/11_workers.js +++ b/runtime/js/11_workers.js @@ -318,10 +318,13 @@ ); options = { transfer }; } else { - options = webidl.converters.PostMessageOptions(transferOrOptions, { - prefix, - context: "Argument 2", - }); + options = webidl.converters.StructuredSerializeOptions( + transferOrOptions, + { + prefix, + context: "Argument 2", + }, + ); } const { transfer } = options; const data = serializeJsMessageData(message, transfer); diff --git a/runtime/js/99_main.js b/runtime/js/99_main.js index 16a444098..a85c40eb9 100644 --- a/runtime/js/99_main.js +++ b/runtime/js/99_main.js @@ -105,10 +105,13 @@ delete Object.prototype.__proto__; ); options = { transfer }; } else { - options = webidl.converters.PostMessageOptions(transferOrOptions, { - prefix, - context: "Argument 2", - }); + options = webidl.converters.StructuredSerializeOptions( + transferOrOptions, + { + prefix, + context: "Argument 2", + }, + ); } const { transfer } = options; const data = serializeJsMessageData(message, transfer); @@ -373,6 +376,7 @@ delete Object.prototype.__proto__; performance: util.writable(performance.performance), setInterval: util.writable(timers.setInterval), setTimeout: util.writable(timers.setTimeout), + structuredClone: util.writable(messagePort.structuredClone), GPU: util.nonEnumerable(webgpu.GPU), GPUAdapter: util.nonEnumerable(webgpu.GPUAdapter), |