[Pkg-javascript-commits] [pdf.js] 198/210: Add preprocessor directives for the extension; and refactor FirefoxCom callback

David Prévot taffit at moszumanska.debian.org
Thu Jun 5 14:21:17 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 68b037ffb0177231f2f82238b5274fac97d9f3ec
Author: Yury Delendik <ydelendik at mozilla.com>
Date:   Wed May 28 10:21:58 2014 -0500

    Add preprocessor directives for the extension; and refactor FirefoxCom callback
---
 extensions/firefox/content/PdfStreamConverter.jsm | 11 +++++++++--
 web/firefoxcom.js                                 |  9 ++++++---
 2 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/extensions/firefox/content/PdfStreamConverter.jsm b/extensions/firefox/content/PdfStreamConverter.jsm
index f36ed52..f4a45a2 100644
--- a/extensions/firefox/content/PdfStreamConverter.jsm
+++ b/extensions/firefox/content/PdfStreamConverter.jsm
@@ -161,15 +161,22 @@ function getLocalizedString(strings, id, property) {
 }
 
 function makeContentReadable(obj, window) {
+//#if MOZCENTRAL
+  return Cu.cloneInto(obj, window);
+//#else
   if (Cu.cloneInto) {
     return Cu.cloneInto(obj, window);
   }
+  if (typeof obj !== 'object' || obj === null) {
+    return obj;
+  }
   var expose = {};
   for (let k in obj) {
     expose[k] = "r";
   }
   obj.__exposedProps__ = expose;
   return obj;
+//#endif
 }
 
 // PDF data storage
@@ -698,7 +705,7 @@ var StandardChromeActions = (function StandardChromeActionsClosure() {
   return StandardChromeActions;
 })();
 
-// Event listener to trigger chrome privedged code.
+// Event listener to trigger chrome privileged code.
 function RequestListener(actions) {
   this.actions = actions;
 }
@@ -719,7 +726,7 @@ RequestListener.prototype.receive = function(event) {
     event.detail.response = response;
   } else {
     var response;
-    if (!event.detail.callback) {
+    if (!event.detail.responseExpected) {
       doc.documentElement.removeChild(message);
       response = null;
     } else {
diff --git a/web/firefoxcom.js b/web/firefoxcom.js
index 4a54893..8a775ac 100644
--- a/web/firefoxcom.js
+++ b/web/firefoxcom.js
@@ -64,9 +64,12 @@ var FirefoxCom = (function FirefoxComClosure() {
       document.documentElement.appendChild(request);
 
       var sender = document.createEvent('CustomEvent');
-      sender.initCustomEvent('pdf.js.message', true, false,
-                             {action: action, data: data, sync: false,
-                              callback: callback});
+      sender.initCustomEvent('pdf.js.message', true, false, {
+        action: action,
+        data: data,
+        sync: false,
+        responseExpected: !!callback
+      });
       return request.dispatchEvent(sender);
     }
   };

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