From f0534b9b51fe3764d144e1a867b0b2645535caa9 Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Thu, 5 Sep 2019 10:30:09 +0200 Subject: [PATCH] Adjust the values sent, with the 'test' message, by the `WorkerMessageHandler.setup` method Note how the sent values have inconsistent types, with a boolean in one case and an object in the other (normal) case. Furthermore, explicitly sending a `supportTypedArray: true` property seems superfluous at least to me. --- src/core/worker.js | 9 +++------ src/display/api.js | 2 +- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/core/worker.js b/src/core/worker.js index 17a44d88d..848b6f7e3 100644 --- a/src/core/worker.js +++ b/src/core/worker.js @@ -67,17 +67,14 @@ var WorkerMessageHandler = { // check if Uint8Array can be sent to worker if (!(data instanceof Uint8Array)) { - handler.send('test', false); + handler.send('test', null); return; } // making sure postMessage transfers are working - var supportTransfers = data[0] === 255; + const supportTransfers = data[0] === 255; handler.postMessageTransfers = supportTransfers; - handler.send('test', { - supportTypedArray: true, - supportTransfers, - }); + handler.send('test', { supportTransfers, }); }); handler.on('configure', function wphConfigure(data) { diff --git a/src/display/api.js b/src/display/api.js index a964d52ff..fa41abab7 100644 --- a/src/display/api.js +++ b/src/display/api.js @@ -1665,7 +1665,7 @@ const PDFWorker = (function PDFWorkerClosure() { terminateEarly(); return; // worker was destroyed } - if (data && data.supportTypedArray) { + if (data) { // supportTypedArray this._messageHandler = messageHandler; this._port = worker; this._webWorker = worker;