Improve work-around for importScripts bug.

Reverts "Hack to avoid intermidiate Chrome failures during tests."
(2b2c521213).

require.js uses importScript asynchronously, which activates the worker
GC bug in WebKit. This patch works around a bug in a way that is similar
in the upcoming (but not yet released) require.js 2.1.23

The advantage of the new work-around is that it allows the runtime to
garbage-collect idle Workers.

References:
- https://crbug.com/572225
- https://webkit.org/b/153317
This commit is contained in:
Rob Wu 2016-01-22 01:27:28 +01:00
parent 58329f7f92
commit 097e273ca4
2 changed files with 11 additions and 9 deletions

View file

@ -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': '.'}});