diff --git a/bower.json b/bower.json index f227f71f4..8b23b33e0 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "pdfjs-dist", - "version": "1.2.39", + "version": "1.2.41", "main": [ "build/pdf.js", "build/pdf.worker.js" diff --git a/build/pdf.combined.js b/build/pdf.combined.js index b632a50dc..db2ee565e 100644 --- a/build/pdf.combined.js +++ b/build/pdf.combined.js @@ -22,8 +22,8 @@ if (typeof PDFJS === 'undefined') { (typeof window !== 'undefined' ? window : this).PDFJS = {}; } -PDFJS.version = '1.2.39'; -PDFJS.build = '7e79ce4'; +PDFJS.version = '1.2.41'; +PDFJS.build = 'b56b415'; (function pdfjsWrapper() { // Use strict in our context only - users might not want it @@ -2820,6 +2820,10 @@ var WorkerTransport = (function WorkerTransportClosure() { }, this); messageHandler.on('commonobj', function transportObj(data) { + if (this.destroyed) { + return; // Ignore any pending requests if the worker was terminated. + } + var id = data[0]; var type = data[1]; if (this.commonObjs.hasData(id)) { @@ -2856,6 +2860,10 @@ var WorkerTransport = (function WorkerTransportClosure() { }, this); messageHandler.on('obj', function transportObj(data) { + if (this.destroyed) { + return; // Ignore any pending requests if the worker was terminated. + } + var id = data[0]; var pageIndex = data[1]; var type = data[2]; @@ -2887,6 +2895,10 @@ var WorkerTransport = (function WorkerTransportClosure() { }, this); messageHandler.on('DocProgress', function transportDocProgress(data) { + if (this.destroyed) { + return; // Ignore any pending requests if the worker was terminated. + } + var loadingTask = this.loadingTask; if (loadingTask.onProgress) { loadingTask.onProgress({ @@ -2897,6 +2909,10 @@ var WorkerTransport = (function WorkerTransportClosure() { }, this); messageHandler.on('PageError', function transportError(data) { + if (this.destroyed) { + return; // Ignore any pending requests if the worker was terminated. + } + var page = this.pageCache[data.pageNum - 1]; var intentState = page.intentStates[data.intent]; if (intentState.displayReadyCapability) { @@ -2907,6 +2923,10 @@ var WorkerTransport = (function WorkerTransportClosure() { }, this); messageHandler.on('JpegDecode', function(data) { + if (this.destroyed) { + return Promise.reject('Worker was terminated'); + } + var imageUrl = data[0]; var components = data[1]; if (components !== 3 && components !== 1) { @@ -2946,7 +2966,7 @@ var WorkerTransport = (function WorkerTransportClosure() { }; img.src = imageUrl; }); - }); + }, this); }, fetchDocument: function WorkerTransport_fetchDocument(loadingTask, source) { diff --git a/build/pdf.js b/build/pdf.js index c17ed6f89..db30b40ee 100644 --- a/build/pdf.js +++ b/build/pdf.js @@ -22,8 +22,8 @@ if (typeof PDFJS === 'undefined') { (typeof window !== 'undefined' ? window : this).PDFJS = {}; } -PDFJS.version = '1.2.39'; -PDFJS.build = '7e79ce4'; +PDFJS.version = '1.2.41'; +PDFJS.build = 'b56b415'; (function pdfjsWrapper() { // Use strict in our context only - users might not want it @@ -2873,6 +2873,10 @@ var WorkerTransport = (function WorkerTransportClosure() { }, this); messageHandler.on('commonobj', function transportObj(data) { + if (this.destroyed) { + return; // Ignore any pending requests if the worker was terminated. + } + var id = data[0]; var type = data[1]; if (this.commonObjs.hasData(id)) { @@ -2909,6 +2913,10 @@ var WorkerTransport = (function WorkerTransportClosure() { }, this); messageHandler.on('obj', function transportObj(data) { + if (this.destroyed) { + return; // Ignore any pending requests if the worker was terminated. + } + var id = data[0]; var pageIndex = data[1]; var type = data[2]; @@ -2940,6 +2948,10 @@ var WorkerTransport = (function WorkerTransportClosure() { }, this); messageHandler.on('DocProgress', function transportDocProgress(data) { + if (this.destroyed) { + return; // Ignore any pending requests if the worker was terminated. + } + var loadingTask = this.loadingTask; if (loadingTask.onProgress) { loadingTask.onProgress({ @@ -2950,6 +2962,10 @@ var WorkerTransport = (function WorkerTransportClosure() { }, this); messageHandler.on('PageError', function transportError(data) { + if (this.destroyed) { + return; // Ignore any pending requests if the worker was terminated. + } + var page = this.pageCache[data.pageNum - 1]; var intentState = page.intentStates[data.intent]; if (intentState.displayReadyCapability) { @@ -2960,6 +2976,10 @@ var WorkerTransport = (function WorkerTransportClosure() { }, this); messageHandler.on('JpegDecode', function(data) { + if (this.destroyed) { + return Promise.reject('Worker was terminated'); + } + var imageUrl = data[0]; var components = data[1]; if (components !== 3 && components !== 1) { @@ -2999,7 +3019,7 @@ var WorkerTransport = (function WorkerTransportClosure() { }; img.src = imageUrl; }); - }); + }, this); }, fetchDocument: function WorkerTransport_fetchDocument(loadingTask, source) { diff --git a/build/pdf.worker.js b/build/pdf.worker.js index 2618ae16a..5664f9837 100644 --- a/build/pdf.worker.js +++ b/build/pdf.worker.js @@ -22,8 +22,8 @@ if (typeof PDFJS === 'undefined') { (typeof window !== 'undefined' ? window : this).PDFJS = {}; } -PDFJS.version = '1.2.39'; -PDFJS.build = '7e79ce4'; +PDFJS.version = '1.2.41'; +PDFJS.build = 'b56b415'; (function pdfjsWrapper() { // Use strict in our context only - users might not want it diff --git a/package.json b/package.json index 67fa841c5..211ecf2a9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "pdfjs-dist", - "version": "1.2.39", + "version": "1.2.41", "description": "Generic build of Mozilla's PDF.js library.", "keywords": [ "Mozilla",