[Pkg-javascript-commits] [pdf.js] 219/414: [Addon] Catch errors in `getFindBar` (in PdfStreamConverter.jsm) to fix loading of PDF files in the bookmark sidebar (bug 1248959)

David Prévot taffit at moszumanska.debian.org
Tue Jun 28 17:12:24 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 f64113c927b10672d26b05087cd5f635cd96dc57
Author: Jonas Jenwald <jonas.jenwald at gmail.com>
Date:   Thu Feb 18 13:59:18 2016 +0100

    [Addon] Catch errors in `getFindBar` (in PdfStreamConverter.jsm) to fix loading of PDF files in the bookmark sidebar (bug 1248959)
    
    Fixes https://bugzilla.mozilla.org/show_bug.cgi?id=1248959.
---
 extensions/firefox/content/PdfStreamConverter.jsm | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/extensions/firefox/content/PdfStreamConverter.jsm b/extensions/firefox/content/PdfStreamConverter.jsm
index d97344c..4e3d5d2 100644
--- a/extensions/firefox/content/PdfStreamConverter.jsm
+++ b/extensions/firefox/content/PdfStreamConverter.jsm
@@ -82,9 +82,15 @@ function getFindBar(domWindow) {
 //#endif
     return tabbrowser.getFindBar(tab);
   } catch (e) {
-    // FF22 has no _getTabForBrowser, and FF24 has no getFindBar
-    var chromeWindow = browser.ownerDocument.defaultView;
-    return chromeWindow.gFindBar;
+    try {
+      // FF22 has no _getTabForBrowser, and FF24 has no getFindBar
+      var chromeWindow = browser.ownerDocument.defaultView;
+      return chromeWindow.gFindBar;
+    } catch (ex) {
+      // Suppress errors for PDF files opened in the bookmark sidebar, see
+      // https://bugzilla.mozilla.org/show_bug.cgi?id=1248959.
+      return null;
+    }
   }
 }
 
@@ -407,7 +413,7 @@ ChromeActions.prototype = {
 
     // ... or when the new find events code exists.
     var findBar = getFindBar(this.domWindow);
-    return findBar && ('updateControlState' in findBar);
+    return !!findBar && ('updateControlState' in findBar);
   },
   supportsDocumentFonts: function() {
     var prefBrowser = getIntPref('browser.display.use_document_fonts', 1);

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