[Pkg-javascript-commits] [pdf.js] 92/210: Remove 'javaScript' 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 069f0cc8c0326c45c116da7139cf14c8601dea36
Author: Jonas Jenwald <jonas.jenwald at gmail.com>
Date:   Wed May 7 21:15:34 2014 +0200

    Remove 'javaScript' from GetDoc
---
 src/core/worker.js | 14 ++++++++++----
 src/display/api.js | 15 +++++++++++----
 2 files changed, 21 insertions(+), 8 deletions(-)

diff --git a/src/core/worker.js b/src/core/worker.js
index 770d7fe..68b7016 100644
--- a/src/core/worker.js
+++ b/src/core/worker.js
@@ -35,10 +35,9 @@ var WorkerMessageHandler = PDFJS.WorkerMessageHandler = {
         var infoPromise = pdfManager.ensureDoc('documentInfo');
         var metadataPromise = pdfManager.ensureCatalog('metadata');
         var encryptedPromise = pdfManager.ensureXRef('encrypt');
-        var javaScriptPromise = pdfManager.ensureCatalog('javaScript');
         Promise.all([numPagesPromise, fingerprintPromise,
-                     infoPromise, metadataPromise, encryptedPromise,
-                     javaScriptPromise]).then(function onDocReady(results) {
+                     infoPromise, metadataPromise, encryptedPromise
+                     ]).then(function onDocReady(results) {
 
           var doc = {
             numPages: results[0],
@@ -46,7 +45,6 @@ var WorkerMessageHandler = PDFJS.WorkerMessageHandler = {
             info: results[2],
             metadata: results[3],
             encrypted: !!results[4],
-            javaScript: results[5]
           };
           loadDocumentCapability.resolve(doc);
         },
@@ -311,6 +309,14 @@ var WorkerMessageHandler = PDFJS.WorkerMessageHandler = {
       }
     );
 
+    handler.on('GetJavaScript',
+      function wphSetupGetJavaScript(data, deferred) {
+        pdfManager.ensureCatalog('javaScript').then(function (js) {
+          deferred.resolve(js);
+        }, deferred.reject);
+      }
+    );
+
     handler.on('GetOutline',
       function wphSetupGetOutline(data, deferred) {
         pdfManager.ensureCatalog('documentOutline').then(function (outline) {
diff --git a/src/display/api.js b/src/display/api.js
index f8cbdc6..0b6915c 100644
--- a/src/display/api.js
+++ b/src/display/api.js
@@ -272,10 +272,7 @@ var PDFDocumentProxy = (function PDFDocumentProxyClosure() {
      * JavaScript strings in the name tree.
      */
     getJavaScript: function PDFDocumentProxy_getJavaScript() {
-      return new Promise(function (resolve) {
-        var js = this.pdfInfo.javaScript;
-        resolve(js);
-      }.bind(this));
+      return this.transport.getJavaScript();
     },
     /**
      * @return {Promise} A promise that is resolved with an {Array} that is a
@@ -1063,6 +1060,16 @@ var WorkerTransport = (function WorkerTransportClosure() {
       }.bind(this));
     },
 
+    getJavaScript: function WorkerTransport_getJavaScript() {
+      return new Promise(function (resolve) {
+        this.messageHandler.send('GetJavaScript', null,
+          function transportJavaScript(js) {
+            resolve(js);
+          }
+        );
+      }.bind(this));
+    },
+
     getOutline: function WorkerTransport_getOutline() {
       return new Promise(function (resolve) {
         this.messageHandler.send('GetOutline', null,

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