Merge pull request #16175 from Snuffleupagus/LoopbackPort-transfer
Fix the `transfer` parameter, for `structuredClone`, in the `LoopbackPort`
This commit is contained in:
commit
b1e0253f29
@ -1943,9 +1943,9 @@ class LoopbackPort {
|
|||||||
|
|
||||||
#deferred = Promise.resolve();
|
#deferred = Promise.resolve();
|
||||||
|
|
||||||
postMessage(obj, transfers) {
|
postMessage(obj, transfer) {
|
||||||
const event = {
|
const event = {
|
||||||
data: structuredClone(obj, transfers),
|
data: structuredClone(obj, transfer ? { transfer } : null),
|
||||||
};
|
};
|
||||||
|
|
||||||
this.#deferred.then(() => {
|
this.#deferred.then(() => {
|
||||||
|
@ -208,10 +208,8 @@ describe("api", function () {
|
|||||||
expect(data[0] instanceof PDFDocumentProxy).toEqual(true);
|
expect(data[0] instanceof PDFDocumentProxy).toEqual(true);
|
||||||
expect(data[1].loaded / data[1].total).toEqual(1);
|
expect(data[1].loaded / data[1].total).toEqual(1);
|
||||||
|
|
||||||
if (!isNodeJS) {
|
|
||||||
// Check that the TypedArray was transferred.
|
// Check that the TypedArray was transferred.
|
||||||
expect(typedArrayPdf.length).toEqual(0);
|
expect(typedArrayPdf.length).toEqual(0);
|
||||||
}
|
|
||||||
|
|
||||||
await loadingTask.destroy();
|
await loadingTask.destroy();
|
||||||
});
|
});
|
||||||
@ -240,10 +238,8 @@ describe("api", function () {
|
|||||||
expect(data[0] instanceof PDFDocumentProxy).toEqual(true);
|
expect(data[0] instanceof PDFDocumentProxy).toEqual(true);
|
||||||
expect(data[1].loaded / data[1].total).toEqual(1);
|
expect(data[1].loaded / data[1].total).toEqual(1);
|
||||||
|
|
||||||
if (!isNodeJS) {
|
|
||||||
// Check that the ArrayBuffer was transferred.
|
// Check that the ArrayBuffer was transferred.
|
||||||
expect(arrayBufferPdf.byteLength).toEqual(0);
|
expect(arrayBufferPdf.byteLength).toEqual(0);
|
||||||
}
|
|
||||||
|
|
||||||
await loadingTask.destroy();
|
await loadingTask.destroy();
|
||||||
});
|
});
|
||||||
@ -3368,12 +3364,10 @@ Caron Broadcasting, Inc., an Ohio corporation (“Lessee”).`)
|
|||||||
expect(pdfPage.rotate).toEqual(0);
|
expect(pdfPage.rotate).toEqual(0);
|
||||||
expect(fetches).toBeGreaterThan(2);
|
expect(fetches).toBeGreaterThan(2);
|
||||||
|
|
||||||
if (!isNodeJS) {
|
|
||||||
// Check that the TypedArrays were transferred.
|
// Check that the TypedArrays were transferred.
|
||||||
for (const array of subArrays) {
|
for (const array of subArrays) {
|
||||||
expect(array.length).toEqual(0);
|
expect(array.length).toEqual(0);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
await loadingTask.destroy();
|
await loadingTask.destroy();
|
||||||
});
|
});
|
||||||
@ -3417,12 +3411,10 @@ Caron Broadcasting, Inc., an Ohio corporation (“Lessee”).`)
|
|||||||
waitSome(resolve);
|
waitSome(resolve);
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!isNodeJS) {
|
|
||||||
// Check that the TypedArrays were transferred.
|
// Check that the TypedArrays were transferred.
|
||||||
for (const array of subArrays) {
|
for (const array of subArrays) {
|
||||||
expect(array.length).toEqual(0);
|
expect(array.length).toEqual(0);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
await loadingTask.destroy();
|
await loadingTask.destroy();
|
||||||
});
|
});
|
||||||
@ -3458,12 +3450,10 @@ Caron Broadcasting, Inc., an Ohio corporation (“Lessee”).`)
|
|||||||
expect(pdfPage.rotate).toEqual(0);
|
expect(pdfPage.rotate).toEqual(0);
|
||||||
expect(fetches).toEqual(0);
|
expect(fetches).toEqual(0);
|
||||||
|
|
||||||
if (!isNodeJS) {
|
|
||||||
// Check that the TypedArrays were transferred.
|
// Check that the TypedArrays were transferred.
|
||||||
for (const array of subArrays) {
|
for (const array of subArrays) {
|
||||||
expect(array.length).toEqual(0);
|
expect(array.length).toEqual(0);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
await loadingTask.destroy();
|
await loadingTask.destroy();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user