diff --git a/src/core/worker.js b/src/core/worker.js index 5ec40561d..04fc03abe 100644 --- a/src/core/worker.js +++ b/src/core/worker.js @@ -75,9 +75,8 @@ class WorkerMessageHandler { } testMessageProcessed = true; - // Ensure that `TypedArray`s can be sent to the worker, - // and that `postMessage` transfers are supported. - handler.send("test", data instanceof Uint8Array && data[0] === 255); + // Ensure that `TypedArray`s can be sent to the worker. + handler.send("test", data instanceof Uint8Array); }); handler.on("configure", function wphConfigure(data) { diff --git a/src/display/api.js b/src/display/api.js index b743a0ec0..df5ad2a8b 100644 --- a/src/display/api.js +++ b/src/display/api.js @@ -2167,16 +2167,9 @@ class PDFWorker { }); const sendTest = () => { - const testObj = new Uint8Array([255]); - // Some versions of Opera throw a DATA_CLONE_ERR on serializing the - // typed array. Also, checking if we can use transfers. - try { - messageHandler.send("test", testObj, [testObj.buffer]); - } catch (ex) { - warn("Cannot use postMessage transfers."); - testObj[0] = 0; - messageHandler.send("test", testObj); - } + const testObj = new Uint8Array(); + // Ensure that we can use `postMessage` transfers. + messageHandler.send("test", testObj, [testObj.buffer]); }; // It might take time for the worker to initialize. We will try to send