From 4342993a3f9c11d21a362857e5cc7d0730feda79 Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Wed, 29 Jun 2016 15:18:12 +0200 Subject: [PATCH] Ensure that the necessary src/* dependencies are loaded before the viewer, when it's run with `gulp server` (issue 7448) Fixes 7448. --- web/viewer.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/web/viewer.js b/web/viewer.js index 59fbbeff7..a18d033db 100644 --- a/web/viewer.js +++ b/web/viewer.js @@ -169,9 +169,14 @@ function webViewerLoad() { var config = getViewerConfiguration(); //#if !PRODUCTION require.config({paths: {'pdfjs': '../src', 'pdfjs-web': '.'}}); - require(['pdfjs-web/app', 'mozPrintCallback_polyfill.js'], function (web) { - window.PDFViewerApplication = web.PDFViewerApplication; - web.PDFViewerApplication.run(config); + require(['pdfjs-web/pdfjs'], function () { + // Ensure that src/main_loader.js has loaded all the necessary dependencies + // *before* the viewer loads, to prevent issues in browsers relying on e.g. + // the Promise/URL polyfill in src/shared/util.js (fixes issue 7448). + require(['pdfjs-web/app', 'mozPrintCallback_polyfill.js'], function (web) { + window.PDFViewerApplication = web.PDFViewerApplication; + web.PDFViewerApplication.run(config); + }); }); //#else //window.PDFViewerApplication = pdfjsWebLibs.pdfjsWebApp.PDFViewerApplication;