[Pkg-javascript-commits] [pdf.js] 91/210: Remove 'outline' from GetDoc

David Prévot taffit at moszumanska.debian.org
Thu Jun 5 14:21:05 UTC 2014


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

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

commit 4bfcb27d0be27b5e7516a27238b65bd2f218404e
Author: Jonas Jenwald <jonas.jenwald at gmail.com>
Date:   Wed May 7 21:06:44 2014 +0200

    Remove 'outline' from GetDoc
---
 src/core/worker.js | 20 +++++++++++++-------
 src/display/api.js | 15 +++++++++++----
 2 files changed, 24 insertions(+), 11 deletions(-)

diff --git a/src/core/worker.js b/src/core/worker.js
index 2b15e52..770d7fe 100644
--- a/src/core/worker.js
+++ b/src/core/worker.js
@@ -32,23 +32,21 @@ var WorkerMessageHandler = PDFJS.WorkerMessageHandler = {
       var parseSuccess = function parseSuccess() {
         var numPagesPromise = pdfManager.ensureDoc('numPages');
         var fingerprintPromise = pdfManager.ensureDoc('fingerprint');
-        var outlinePromise = pdfManager.ensureCatalog('documentOutline');
         var infoPromise = pdfManager.ensureDoc('documentInfo');
         var metadataPromise = pdfManager.ensureCatalog('metadata');
         var encryptedPromise = pdfManager.ensureXRef('encrypt');
         var javaScriptPromise = pdfManager.ensureCatalog('javaScript');
-        Promise.all([numPagesPromise, fingerprintPromise, outlinePromise,
+        Promise.all([numPagesPromise, fingerprintPromise,
                      infoPromise, metadataPromise, encryptedPromise,
                      javaScriptPromise]).then(function onDocReady(results) {
 
           var doc = {
             numPages: results[0],
             fingerprint: results[1],
-            outline: results[2],
-            info: results[3],
-            metadata: results[4],
-            encrypted: !!results[5],
-            javaScript: results[6]
+            info: results[2],
+            metadata: results[3],
+            encrypted: !!results[4],
+            javaScript: results[5]
           };
           loadDocumentCapability.resolve(doc);
         },
@@ -313,6 +311,14 @@ var WorkerMessageHandler = PDFJS.WorkerMessageHandler = {
       }
     );
 
+    handler.on('GetOutline',
+      function wphSetupGetOutline(data, deferred) {
+        pdfManager.ensureCatalog('documentOutline').then(function (outline) {
+          deferred.resolve(outline);
+        }, deferred.reject);
+      }
+    );
+
     handler.on('GetData', function wphSetupGetData(data, deferred) {
       pdfManager.requestLoadedStream();
       pdfManager.onLoadedStream().then(function(stream) {
diff --git a/src/display/api.js b/src/display/api.js
index e7035ab..f8cbdc6 100644
--- a/src/display/api.js
+++ b/src/display/api.js
@@ -293,10 +293,7 @@ var PDFDocumentProxy = (function PDFDocumentProxyClosure() {
      * ].
      */
     getOutline: function PDFDocumentProxy_getOutline() {
-      return new Promise(function (resolve) {
-        var outline = this.pdfInfo.outline;
-        resolve(outline);
-      }.bind(this));
+      return this.transport.getOutline();
     },
     /**
      * @return {Promise} A promise that is resolved with an {Object} that has
@@ -1066,6 +1063,16 @@ var WorkerTransport = (function WorkerTransportClosure() {
       }.bind(this));
     },
 
+    getOutline: function WorkerTransport_getOutline() {
+      return new Promise(function (resolve) {
+        this.messageHandler.send('GetOutline', null,
+          function transportOutline(outline) {
+            resolve(outline);
+          }
+        );
+      }.bind(this));
+    },
+
     startCleanup: function WorkerTransport_startCleanup() {
       this.messageHandler.send('Cleanup', null,
         function endCleanup() {

-- 
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