[Pkg-javascript-commits] [pdf.js] 369/414: Replace pdfjsLib with module that represents pdf.js.

David Prévot taffit at moszumanska.debian.org
Tue Jun 28 17:12:40 UTC 2016


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository pdf.js.

commit 4165cedc9fb27fe1543f8058143a8969e97f162e
Author: Yury Delendik <ydelendik at mozilla.com>
Date:   Fri Apr 8 14:15:48 2016 -0500

    Replace pdfjsLib with module that represents pdf.js.
---
 web/annotation_layer_builder.js | 10 +++++-----
 web/app.js                      | 13 +++++++------
 web/chromecom.js                | 11 ++++++-----
 web/debugger.js                 | 11 +++++------
 web/download_manager.js         | 10 +++++-----
 web/firefoxcom.js               | 12 ++++++------
 web/password_prompt.js          | 11 ++++++-----
 web/pdf_attachment_viewer.js    | 10 +++++-----
 web/pdf_outline_viewer.js       | 10 +++++-----
 web/pdf_page_view.js            | 10 +++++-----
 web/pdf_viewer.component.js     | 36 ++++++++++++++++++++----------------
 web/pdf_viewer.js               | 10 +++++-----
 web/pdfjs.js                    | 34 ++++++++++++++++++++++++++++++++++
 web/text_layer_builder.js       | 10 +++++-----
 web/ui_utils.js                 | 13 +++++--------
 web/viewer.js                   | 15 +++++++++------
 16 files changed, 133 insertions(+), 93 deletions(-)

diff --git a/web/annotation_layer_builder.js b/web/annotation_layer_builder.js
index 37da4e8..9a77bf5 100644
--- a/web/annotation_layer_builder.js
+++ b/web/annotation_layer_builder.js
@@ -12,22 +12,22 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-/*globals pdfjsLib */
 
 'use strict';
 
 (function (root, factory) {
   if (typeof define === 'function' && define.amd) {
     define('pdfjs-web/annotation_layer_builder', ['exports',
-      'pdfjs-web/ui_utils', 'pdfjs-web/pdf_link_service'], factory);
+      'pdfjs-web/ui_utils', 'pdfjs-web/pdf_link_service',
+      'pdfjs-web/pdfjs'], factory);
   } else if (typeof exports !== 'undefined') {
     factory(exports, require('./ui_utils.js'),
-      require('./pdf_link_service.js'));
+      require('./pdf_link_service.js'), require('./pdfjs.js'));
   } else {
     factory((root.pdfjsWebAnnotationLayerBuilder = {}), root.pdfjsWebUIUtils,
-      root.pdfjsWebPDFLinkService);
+      root.pdfjsWebPDFLinkService, root.pdfjsWebPDFJS);
   }
-}(this, function (exports, uiUtils, pdfLinkService) {
+}(this, function (exports, uiUtils, pdfLinkService, pdfjsLib) {
 
 var mozL10n = uiUtils.mozL10n;
 var SimpleLinkService = pdfLinkService.SimpleLinkService;
diff --git a/web/app.js b/web/app.js
index 9dbee31..307e47d 100644
--- a/web/app.js
+++ b/web/app.js
@@ -12,7 +12,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-/* globals DEFAULT_URL, pdfjsLib, PDFBug, Stats */
+/* globals DEFAULT_URL, PDFBug, Stats */
 
 'use strict';
 
@@ -28,7 +28,8 @@
       'pdfjs-web/pdf_rendering_queue', 'pdfjs-web/pdf_link_service',
       'pdfjs-web/pdf_outline_viewer', 'pdfjs-web/overlay_manager',
       'pdfjs-web/pdf_attachment_viewer', 'pdfjs-web/pdf_find_controller',
-      'pdfjs-web/pdf_find_bar', 'pdfjs-web/mozPrintCallback_polyfill'],
+      'pdfjs-web/pdf_find_bar', 'pdfjs-web/mozPrintCallback_polyfill',
+      'pdfjs-web/pdfjs'],
       factory);
   } else if (typeof exports !== 'undefined') {
     factory(exports, require('./ui_utils.js'), require('./firefoxcom.js'),
@@ -42,7 +43,7 @@
       require('./pdf_link_service.js'), require('./pdf_outline_viewer.js'),
       require('./overlay_manager.js'), require('./pdf_attachment_viewer.js'),
       require('./pdf_find_controller.js'), require('./pdf_find_bar.js'),
-      require('./mozPrintCallback_polyfill.js'));
+      require('./mozPrintCallback_polyfill.js'), require('./pdfjs.js'));
   } else {
     factory((root.pdfjsWebApp = {}), root.pdfjsWebUIUtils,
       root.pdfjsWebFirefoxCom, root.pdfjsWebDownloadManager,
@@ -55,7 +56,7 @@
       root.pdfjsWebPDFLinkService, root.pdfjsWebPDFOutlineViewer,
       root.pdfjsWebOverlayManager, root.pdfjsWebPDFAttachmentViewer,
       root.pdfjsWebPDFFindController, root.pdfjsWebPDFFindBar,
-      root.pdfjsWebMozPrintCallbackPolyfill);
+      root.pdfjsWebMozPrintCallbackPolyfill, root.pdfjsWebPDFJS);
   }
 }(this, function (exports, uiUtilsLib, firefoxComLib, downloadManagerLib,
                   pdfHistoryLib, preferencesLib, pdfSidebarLib, viewHistoryLib,
@@ -64,7 +65,7 @@
                   pdfViewerLib, pdfRenderingQueueLib, pdfLinkServiceLib,
                   pdfOutlineViewerLib, overlayManagerLib,
                   pdfAttachmentViewerLib, pdfFindControllerLib, pdfFindBarLib,
-                  mozPrintCallbackPolyfillLib) {
+                  mozPrintCallbackPolyfillLib, pdfjsLib) {
 
 var FirefoxCom = firefoxComLib.FirefoxCom;
 var UNKNOWN_SCALE = uiUtilsLib.UNKNOWN_SCALE;
@@ -1423,7 +1424,7 @@ function webViewerInitialized() {
       var pdfBug = hashParams['pdfbug'];
       var enabled = pdfBug.split(',');
       PDFBug.enable(enabled);
-      PDFBug.init();
+      PDFBug.init(pdfjsLib);
     }
   }
 
diff --git a/web/chromecom.js b/web/chromecom.js
index 5464ce7..e587fb3 100644
--- a/web/chromecom.js
+++ b/web/chromecom.js
@@ -13,20 +13,21 @@
  * limitations under the License.
  */
 
-/* globals chrome, pdfjsLib */
+/* globals chrome */
 'use strict';
 
 (function (root, factory) {
   if (typeof define === 'function' && define.amd) {
     define('pdfjs-web/chromecom', ['exports', 'pdfjs-web/app',
-      'pdfjs-web/overlay_manager'], factory);
+      'pdfjs-web/overlay_manager', 'pdfjs-web/pdfjs'], factory);
   } else if (typeof exports !== 'undefined') {
-    factory(exports, require('./app.js'), require('./overlay_manager.js'));
+    factory(exports, require('./app.js'), require('./overlay_manager.js'),
+      require('./pdfjs.js'));
   } else {
     factory((root.pdfjsWebChromeCom = {}), root.pdfjsWebApp,
-      root.pdfjsWebOverlayManager);
+      root.pdfjsWebOverlayManager, root.pdfjsWebPDFJS);
   }
-}(this, function (exports, app, overlayManager) {
+}(this, function (exports, app, overlayManager, pdfjsLib) {
 //#if CHROME
 //#if !CHROME
   if (true) { return; } // TODO ensure nothing depends on this module.
diff --git a/web/debugger.js b/web/debugger.js
index bd3e562..05e279c 100644
--- a/web/debugger.js
+++ b/web/debugger.js
@@ -12,7 +12,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-/* globals pdfjsLib */
 
 'use strict';
 
@@ -65,7 +64,7 @@ var FontInspector = (function FontInspectorClosure() {
     name: 'Font Inspector',
     panel: null,
     manager: null,
-    init: function init() {
+    init: function init(pdfjsLib) {
       var panel = this.panel;
       panel.setAttribute('style', 'padding: 5px;');
       var tmp = document.createElement('button');
@@ -291,7 +290,7 @@ var Stepper = (function StepperClosure() {
     this.operatorListIdx = 0;
   }
   Stepper.prototype = {
-    init: function init() {
+    init: function init(pdfjsLib) {
       var panel = this.panel;
       var content = c('div', 'c=continue, s=step');
       var table = c('table');
@@ -458,7 +457,7 @@ var Stats = (function Stats() {
     name: 'Stats',
     panel: null,
     manager: null,
-    init: function init() {
+    init: function init(pdfjsLib) {
       this.panel.setAttribute('style', 'padding: 5px;');
       pdfjsLib.PDFJS.enableStats = true;
     },
@@ -532,7 +531,7 @@ var PDFBug = (function PDFBugClosure() {
         });
       }
     },
-    init: function init() {
+    init: function init(pdfjsLib) {
       /*
        * Basic Layout:
        * PDFBug
@@ -576,7 +575,7 @@ var PDFBug = (function PDFBugClosure() {
         tool.panel = panel;
         tool.manager = this;
         if (tool.enabled) {
-          tool.init();
+          tool.init(pdfjsLib);
         } else {
           panel.textContent = tool.name + ' is disabled. To enable add ' +
                               ' "' + tool.id + '" to the pdfBug parameter ' +
diff --git a/web/download_manager.js b/web/download_manager.js
index d7cc544..7481764 100644
--- a/web/download_manager.js
+++ b/web/download_manager.js
@@ -12,19 +12,19 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-/* globals pdfjsLib */
 
 'use strict';
 
 (function (root, factory) {
   if (typeof define === 'function' && define.amd) {
-    define('pdfjs-web/download_manager', ['exports'], factory);
+    define('pdfjs-web/download_manager', ['exports', 'pdfjs-web/pdfjs'],
+      factory);
   } else if (typeof exports !== 'undefined') {
-    factory(exports);
+    factory(exports, require('./pdfjs.js'));
   } else {
-    factory((root.pdfjsWebDownloadManager = {}));
+    factory((root.pdfjsWebDownloadManager = {}), root.pdfjsWebPDFJS);
   }
-}(this, function (exports) {
+}(this, function (exports, pdfjsLib) {
 //#if GENERIC || CHROME
   function download(blobUrl, filename) {
     var a = document.createElement('a');
diff --git a/web/firefoxcom.js b/web/firefoxcom.js
index 0d6a3e2..9a60097 100644
--- a/web/firefoxcom.js
+++ b/web/firefoxcom.js
@@ -12,20 +12,20 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-/* globals pdfjsLib */
 
 'use strict';
 
 (function (root, factory) {
   if (typeof define === 'function' && define.amd) {
-    define('pdfjs-web/firefoxcom', ['exports', 'pdfjs-web/preferences'],
-      factory);
+    define('pdfjs-web/firefoxcom', ['exports', 'pdfjs-web/preferences',
+      'pdfjs-web/pdfjs'], factory);
   } else if (typeof exports !== 'undefined') {
-    factory(exports, require('./preferences.js'));
+    factory(exports, require('./preferences.js'), require('./pdfjs.js'));
   } else {
-    factory((root.pdfjsWebFirefoxCom = {}), root.pdfjsWebPreferences);
+    factory((root.pdfjsWebFirefoxCom = {}), root.pdfjsWebPreferences,
+      root.pdfjsWebPDFJS);
   }
-}(this, function (exports, preferences) {
+}(this, function (exports, preferences, pdfjsLib) {
 //#if FIREFOX || MOZCENTRAL
 //#if !(FIREFOX || MOZCENTRAL)
   if (true) { return; }  // TODO ensure nothing depends on this module.
diff --git a/web/password_prompt.js b/web/password_prompt.js
index 38fe8a3..1202dfb 100644
--- a/web/password_prompt.js
+++ b/web/password_prompt.js
@@ -12,21 +12,22 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-/* globals pdfjsLib */
 
 'use strict';
 
 (function (root, factory) {
   if (typeof define === 'function' && define.amd) {
     define('pdfjs-web/password_prompt', ['exports',
-      'pdfjs-web/ui_utils', 'pdfjs-web/overlay_manager'], factory);
+      'pdfjs-web/ui_utils', 'pdfjs-web/overlay_manager', 'pdfjs-web/pdfjs'],
+      factory);
   } else if (typeof exports !== 'undefined') {
-    factory(exports, require('./ui_utils.js'), require('./overlay_manager.js'));
+    factory(exports, require('./ui_utils.js'), require('./overlay_manager.js'),
+      require('./pdfjs.js'));
   } else {
     factory((root.pdfjsWebPasswordPrompt = {}), root.pdfjsWebUIUtils,
-      root.pdfjsWebOverlayManager);
+      root.pdfjsWebOverlayManager, root.pdfjsWebPDFJS);
   }
-}(this, function (exports, uiUtils, overlayManager) {
+}(this, function (exports, uiUtils, overlayManager, pdfjsLib) {
 
 var mozL10n = uiUtils.mozL10n;
 var OverlayManager = overlayManager.OverlayManager;
diff --git a/web/pdf_attachment_viewer.js b/web/pdf_attachment_viewer.js
index 8dc9b0e..5d29d1f 100644
--- a/web/pdf_attachment_viewer.js
+++ b/web/pdf_attachment_viewer.js
@@ -12,19 +12,19 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-/* globals pdfjsLib */
 
 'use strict';
 
 (function (root, factory) {
   if (typeof define === 'function' && define.amd) {
-    define('pdfjs-web/pdf_attachment_viewer', ['exports'], factory);
+    define('pdfjs-web/pdf_attachment_viewer', ['exports', 'pdfjs-web/pdfjs'],
+      factory);
   } else if (typeof exports !== 'undefined') {
-    factory(exports);
+    factory(exports, require('./pdfjs.js'));
   } else {
-    factory((root.pdfjsWebPDFAttachmentViewer = {}));
+    factory((root.pdfjsWebPDFAttachmentViewer = {}), root.pdfjsWebPDFJS);
   }
-}(this, function (exports) {
+}(this, function (exports, pdfjsLib) {
 
 /**
  * @typedef {Object} PDFAttachmentViewerOptions
diff --git a/web/pdf_outline_viewer.js b/web/pdf_outline_viewer.js
index 6fd1425..c231088 100644
--- a/web/pdf_outline_viewer.js
+++ b/web/pdf_outline_viewer.js
@@ -12,19 +12,19 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-/* globals pdfjsLib */
 
 'use strict';
 
 (function (root, factory) {
   if (typeof define === 'function' && define.amd) {
-    define('pdfjs-web/pdf_outline_viewer', ['exports'], factory);
+    define('pdfjs-web/pdf_outline_viewer', ['exports', 'pdfjs-web/pdfjs'],
+      factory);
   } else if (typeof exports !== 'undefined') {
-    factory(exports);
+    factory(exports, require('./pdfjs.js'));
   } else {
-    factory((root.pdfjsWebPDFOutlineViewer = {}));
+    factory((root.pdfjsWebPDFOutlineViewer = {}), root.pdfjsWebPDFJS);
   }
-}(this, function (exports) {
+}(this, function (exports, pdfjsLib) {
 
 var DEFAULT_TITLE = '\u2013';
 
diff --git a/web/pdf_page_view.js b/web/pdf_page_view.js
index 4f3227b..9484ff7 100644
--- a/web/pdf_page_view.js
+++ b/web/pdf_page_view.js
@@ -12,22 +12,22 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-/* globals pdfjsLib */
 
 'use strict';
 
 (function (root, factory) {
   if (typeof define === 'function' && define.amd) {
     define('pdfjs-web/pdf_page_view', ['exports',
-      'pdfjs-web/ui_utils', 'pdfjs-web/pdf_rendering_queue'], factory);
+      'pdfjs-web/ui_utils', 'pdfjs-web/pdf_rendering_queue',
+      'pdfjs-web/pdfjs'], factory);
   } else if (typeof exports !== 'undefined') {
     factory(exports, require('./ui_utils.js'),
-      require('./pdf_rendering_queue.js'));
+      require('./pdf_rendering_queue.js'), require('./pdfjs.js'));
   } else {
     factory((root.pdfjsWebPDFPageView = {}), root.pdfjsWebUIUtils,
-      root.pdfjsWebPDFRenderingQueue);
+      root.pdfjsWebPDFRenderingQueue, root.pdfjsWebPDFJS);
   }
-}(this, function (exports, uiUtils, pdfRenderingQueue) {
+}(this, function (exports, uiUtils, pdfRenderingQueue, pdfjsLib) {
 
 var CSS_UNITS = uiUtils.CSS_UNITS;
 var DEFAULT_SCALE = uiUtils.DEFAULT_SCALE;
diff --git a/web/pdf_viewer.component.js b/web/pdf_viewer.component.js
index f1c33bd..53da359 100644
--- a/web/pdf_viewer.component.js
+++ b/web/pdf_viewer.component.js
@@ -12,29 +12,31 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-/*jshint globalstrict: false */
+/* jshint globalstrict: false */
+/* umdutils ignore */
 
-(function pdfViewerWrapper() {
+(function (root, factory) {
   'use strict';
-
-  var root = this;
-  if (!root.pdfjsLib) {
-    Object.defineProperty(root, 'pdfjsLib', {
-      get: function () {
-        return root.pdfjsDistBuildPdf || root.pdfjsDistBuildPdfCombined ||
-               root.pdfjsMainLoader;
-      },
-      enumerable: true,
-      configurable: true
-    });
+  if (typeof define === 'function' && define.amd) {
+    define('pdfjs-dist/web/pdf.components', ['exports', 'pdfjs-dist/build/pdf'],
+      factory);
+  } else if (typeof exports !== 'undefined') {
+    factory(exports, require('../build/pdf.js'));
+  } else {
+    factory((root.pdfjsDistWebPDFComponents = {}), root.pdfjsDistBuildPdf);
   }
+}(this, function (exports, pdfjsLib) {
+  'use strict';
+
+  var pdfViewerLibs = {
+    pdfjsWebPDFJS: pdfjsLib
+  };
 
-  var pdfViewerLibs = {};
   (function () {
 //#expand __BUNDLE__
   }).call(pdfViewerLibs);
 
-  var PDFJS = window.PDFJS || (window.PDFJS = {});
+  var PDFJS = pdfjsLib.PDFJS;
 
   PDFJS.PDFViewer = pdfViewerLibs.pdfjsWebPDFViewer.PDFViewer;
   PDFJS.PDFPageView = pdfViewerLibs.pdfjsWebPDFPageView.PDFPageView;
@@ -51,4 +53,6 @@
 
   PDFJS.DownloadManager = pdfViewerLibs.pdfjsWebDownloadManager.DownloadManager;
   PDFJS.ProgressBar = pdfViewerLibs.pdfjsWebUIUtils.ProgressBar;
-}).call((typeof window === 'undefined') ? this : window);
+
+  exports.PDFJS = PDFJS;
+}));
diff --git a/web/pdf_viewer.js b/web/pdf_viewer.js
index 8ff3a52..d932867 100644
--- a/web/pdf_viewer.js
+++ b/web/pdf_viewer.js
@@ -12,7 +12,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-/* globals pdfjsLib */
 
 'use strict';
 
@@ -21,20 +20,21 @@
     define('pdfjs-web/pdf_viewer', ['exports', 'pdfjs-web/ui_utils',
       'pdfjs-web/pdf_page_view', 'pdfjs-web/pdf_rendering_queue',
       'pdfjs-web/text_layer_builder', 'pdfjs-web/annotation_layer_builder',
-      'pdfjs-web/pdf_link_service'], factory);
+      'pdfjs-web/pdf_link_service', 'pdfjs-web/pdfjs'], factory);
   } else if (typeof exports !== 'undefined') {
     factory(exports, require('./ui_utils.js'), require('./pdf_page_view.js'),
       require('./pdf_rendering_queue.js'), require('./text_layer_builder.js'),
       require('./annotation_layer_builder.js'),
-      require('./pdf_link_service.js'));
+      require('./pdf_link_service.js'), require('./pdfjs.js'));
   } else {
     factory((root.pdfjsWebPDFViewer = {}), root.pdfjsWebUIUtils,
       root.pdfjsWebPDFPageView, root.pdfjsWebPDFRenderingQueue,
       root.pdfjsWebTextLayerBuilder, root.pdfjsWebAnnotationLayerBuilder,
-      root.pdfjsWebPDFLinkService);
+      root.pdfjsWebPDFLinkService, root.pdfjsWebPDFJS);
   }
 }(this, function (exports, uiUtils, pdfPageView, pdfRenderingQueue,
-                  textLayerBuilder, annotationLayerBuilder, pdfLinkService) {
+                  textLayerBuilder, annotationLayerBuilder, pdfLinkService,
+                  pdfjsLib) {
 
 var UNKNOWN_SCALE = uiUtils.UNKNOWN_SCALE;
 var SCROLLBAR_PADDING = uiUtils.SCROLLBAR_PADDING;
diff --git a/web/pdfjs.js b/web/pdfjs.js
new file mode 100644
index 0000000..60de078
--- /dev/null
+++ b/web/pdfjs.js
@@ -0,0 +1,34 @@
+/* Copyright 2016 Mozilla Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/* umdutils ignore */
+
+'use strict';
+
+(function (root, factory) {
+  if (typeof define === 'function' && define.amd) {
+    define('pdfjs-web/pdfjs', ['exports', 'pdfjs/main_loader'], factory);
+  } else if (typeof exports !== 'undefined') {
+    factory(exports, require('../src/main_loader.js'));
+  } else {
+    factory((root.pdfjsWebPDFJS = {}), root.pdfjsMainLoader);
+  }
+}(this, function (exports, mainLoader) {
+  // Re-export all mainLoader members.
+  for (var i in mainLoader) {
+    if (Object.prototype.hasOwnProperty.call(mainLoader, i)) {
+      exports[i] = mainLoader[i];
+    }
+  }
+}));
diff --git a/web/text_layer_builder.js b/web/text_layer_builder.js
index d64729d..5d6b142 100644
--- a/web/text_layer_builder.js
+++ b/web/text_layer_builder.js
@@ -12,19 +12,19 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-/* globals pdfjsLib */
 
 'use strict';
 
 (function (root, factory) {
   if (typeof define === 'function' && define.amd) {
-    define('pdfjs-web/text_layer_builder', ['exports'], factory);
+    define('pdfjs-web/text_layer_builder', ['exports', 'pdfjs-web/pdfjs'],
+      factory);
   } else if (typeof exports !== 'undefined') {
-    factory(exports);
+    factory(exports, require('./pdfjs.js'));
   } else {
-    factory((root.pdfjsWebTextLayerBuilder = {}));
+    factory((root.pdfjsWebTextLayerBuilder = {}), root.pdfjsWebPDFJS);
   }
-}(this, function (exports) {
+}(this, function (exports, pdfjsLib) {
 
 /**
  * @typedef {Object} TextLayerBuilderOptions
diff --git a/web/ui_utils.js b/web/ui_utils.js
index 08b99b0..0904402 100644
--- a/web/ui_utils.js
+++ b/web/ui_utils.js
@@ -12,19 +12,18 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-/* globals PDFJS */
 
 'use strict';
 
 (function (root, factory) {
   if (typeof define === 'function' && define.amd) {
-    define('pdfjs-web/ui_utils', ['exports'], factory);
+    define('pdfjs-web/ui_utils', ['exports', 'pdfjs-web/pdfjs'], factory);
   } else if (typeof exports !== 'undefined') {
-    factory(exports);
+    factory(exports, require('./pdfjs.js'));
   } else {
-    factory((root.pdfjsWebUIUtils = {}));
+    factory((root.pdfjsWebUIUtils = {}), root.pdfjsWebPDFJS);
   }
-}(this, function (exports) {
+}(this, function (exports, pdfjsLib) {
 
 var CSS_UNITS = 96.0 / 72.0;
 var DEFAULT_SCALE_VALUE = 'auto';
@@ -36,9 +35,7 @@ var VERTICAL_PADDING = 5;
 
 var mozL10n = document.mozL10n || document.webL10n;
 
-if (typeof PDFJS === 'undefined') {
-  (typeof window !== 'undefined' ? window : this).PDFJS = {};
-}
+var PDFJS = pdfjsLib.PDFJS;
 
 /**
  * Disables fullscreen support, and by extension Presentation Mode,
diff --git a/web/viewer.js b/web/viewer.js
index 2b98498..7e393ee 100644
--- a/web/viewer.js
+++ b/web/viewer.js
@@ -18,10 +18,15 @@
 
 var DEFAULT_URL = 'compressed.tracemonkey-pldi-09.pdf';
 
-var pdfjsWebLibs = {};
-(function () {
+//#if PRODUCTION
+//var pdfjsWebLibs = {
+//  pdfjsWebPDFJS: window.pdfjsDistBuildPdf
+//};
+//
+//(function () {
 //#expand __BUNDLE__
-}).call(pdfjsWebLibs);
+//}).call(pdfjsWebLibs);
+//#endif
 
 //#if FIREFOX || MOZCENTRAL
 //// FIXME the l10n.js file in the Firefox extension needs global FirefoxCom.
@@ -48,13 +53,11 @@ var pdfjsWebLibs = {};
 function webViewerLoad() {
 //#if !PRODUCTION
   require.config({paths: {'pdfjs': '../src', 'pdfjs-web': '.'}});
-  require(['pdfjs/main_loader', 'pdfjs-web/app'], function (loader, web) {
-    window.pdfjsLib = loader;
+  require(['pdfjs-web/app'], function (web) {
     window.PDFViewerApplication = web.PDFViewerApplication;
     web.PDFViewerApplication.run();
   });
 //#else
-//window.pdfjsLib = window.pdfjsDistBuildPdf;
 //window.PDFViewerApplication = pdfjsWebLibs.pdfjsWebApp.PDFViewerApplication;
 //pdfjsWebLibs.pdfjsWebApp.PDFViewerApplication.run();
 //#endif

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/pdf.js.git



More information about the Pkg-javascript-commits mailing list