1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-20 15:18:08 +02:00

Fix the transfer parameter, for structuredClone, in the LoopbackPort

The way that we handle the `transfer` parameter is unfortunately wrong, ever since PR 14392 which introduced the code, given that the MDN article originally contained incorrect information; please see https://github.com/mdn/content/pull/23164

By updating the `structuredClone` call such that it works correctly, we can enable more unit-tests in Node.js environments; please refer to https://developer.mozilla.org/en-US/docs/Web/API/structuredClone#parameters
This commit is contained in:
Jonas Jenwald 2023-03-19 21:49:27 +01:00
parent 33f5d94f23
commit c4a725fe98
2 changed files with 15 additions and 25 deletions

View file

@ -1943,9 +1943,9 @@ class LoopbackPort {
#deferred = Promise.resolve();
postMessage(obj, transfers) {
postMessage(obj, transfer) {
const event = {
data: structuredClone(obj, transfers),
data: structuredClone(obj, transfer ? { transfer } : null),
};
this.#deferred.then(() => {