Skip to content

Commit

Permalink
Adjust the values sent, with the 'test' message, by the `WorkerMessag…
Browse files Browse the repository at this point in the history
…eHandler.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.
  • Loading branch information
Snuffleupagus committed Sep 5, 2019
1 parent 7212ff4 commit f0534b9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
9 changes: 3 additions & 6 deletions src/core/worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion src/display/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit f0534b9

Please sign in to comment.