diff --git a/src/display/api.js b/src/display/api.js index 8ee45c0788f87..3c71e412c6794 100644 --- a/src/display/api.js +++ b/src/display/api.js @@ -1301,16 +1301,7 @@ var PDFWorker = (function PDFWorkerClosure() { // https://bugzilla.mozilla.org/show_bug.cgi?id=683280 var worker = new Worker(workerSrc); var messageHandler = new MessageHandler('main', 'worker', worker); -//#if !PRODUCTION - // Don't allow worker to be destroyed by Chrome, see: - // https://code.google.com/p/chromium/issues/detail?id=572225 - var jsWorkerId = '_workerKungfuGrip_' + Math.random(); - window[jsWorkerId] = worker; -//#endif messageHandler.on('test', function PDFWorker_test(data) { -//#if !PRODUCTION - delete window[jsWorkerId]; -//#endif if (this.destroyed) { this._readyCapability.reject(new Error('Worker was destroyed')); messageHandler.destroy(); diff --git a/src/worker_loader.js b/src/worker_loader.js index ea480c74113a9..5c3af1a38658c 100644 --- a/src/worker_loader.js +++ b/src/worker_loader.js @@ -15,6 +15,17 @@ 'use strict'; +//#if !PRODUCTION +//// Patch importScripts to work around a bug in WebKit and Chrome 48-. +//// See https://crbug.com/572225 and https://webkit.org/b/153317. +self.importScripts = (function (importScripts) { + return function() { + setTimeout(function () {}, 0); + return importScripts.apply(this, arguments); + }; +})(importScripts); +//#endif + importScripts('../node_modules/requirejs/require.js'); require.config({paths: {'pdfjs': '.'}});