You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Web browser and its version: This problem can be reproduced in IE 11, when PDF.js is loaded from a different origin (CDN).
Operating system and its version: Windows 7
PDF.js version: 1.4.215
If PDF.js is loaded from a CDN and fail safe mode is triggered (hence making PDF.js trying to initialise a fake worker), if the current AMD loader is almond.js instead of requirejs, loading pdf.worker.js will fail since almond.js does not support dynamic script loading.
This is the code where the exception is thrown:
var fakeWorkerFilesLoader = useRequireEnsure ? (function (callback) {
require.ensure([], function () {
var worker = require('./pdf.worker.js');
callback(worker.WorkerMessageHandler);
});
}) : (typeof requirejs !== 'undefined') ? (function (callback) {
// THIS WILL FAIL IF THE CURRENT AMD LOADER IS ALMOND.JS INSTEAD OF REQUIRE.JS
requirejs(['pdfjs-dist/build/pdf.worker'], function (worker) {
callback(worker.WorkerMessageHandler);
});
}) : null;
One potential solution would be to only dynamic load the dependency if the AMD loader supports it:
This change will set fakeWorkerFilesLoader to null when the ADM loader does not support dynamic loading and worker.js will be loaded using Util.loadScript instead:
var loader = fakeWorkerFilesLoader || function (callback) {
Util.loadScript(getWorkerSrc(), function () {
callback(window.pdfjsDistBuildPdfWorker.WorkerMessageHandler);
});
};
The text was updated successfully, but these errors were encountered:
Configuration:
If PDF.js is loaded from a CDN and fail safe mode is triggered (hence making PDF.js trying to initialise a fake worker), if the current AMD loader is
almond.js
instead ofrequirejs
, loadingpdf.worker.js
will fail sincealmond.js
does not support dynamic script loading.This is the code where the exception is thrown:
One potential solution would be to only dynamic load the dependency if the AMD loader supports it:
instead of
This change will set
fakeWorkerFilesLoader
tonull
when the ADM loader does not support dynamic loading andworker.js
will be loaded usingUtil.loadScript
instead:The text was updated successfully, but these errors were encountered: