From a34e7aa8fe94fe4f7d62ab2aebe3db1075579b97 Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Fri, 10 Oct 2014 22:26:52 +0200 Subject: [PATCH] [Firefox] Use getTabForBrowser instead of _getTabForBrowser if possible --- extensions/firefox/content/PdfStreamConverter.jsm | 13 ++++++++++++- extensions/firefox/content/PdfjsChromeUtils.jsm | 13 ++++++++++++- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/extensions/firefox/content/PdfStreamConverter.jsm b/extensions/firefox/content/PdfStreamConverter.jsm index 4dd26a4a0..ee5376167 100644 --- a/extensions/firefox/content/PdfStreamConverter.jsm +++ b/extensions/firefox/content/PdfStreamConverter.jsm @@ -77,7 +77,18 @@ function getFindBar(domWindow) { var browser = getContainingBrowser(domWindow); try { var tabbrowser = browser.getTabBrowser(); - var tab = tabbrowser._getTabForBrowser(browser); + var tab; +//#if MOZCENTRAL + tab = tabbrowser.getTabForBrowser(browser); +//#else + if (tabbrowser.getTabForBrowser) { + tab = tabbrowser.getTabForBrowser(browser); + } else { + // _getTabForBrowser is depreciated in Firefox 35, see + // https://bugzilla.mozilla.org/show_bug.cgi?id=1039500. + tab = tabbrowser._getTabForBrowser(browser); + } +//#endif return tabbrowser.getFindBar(tab); } catch (e) { // FF22 has no _getTabForBrowser, and FF24 has no getFindBar diff --git a/extensions/firefox/content/PdfjsChromeUtils.jsm b/extensions/firefox/content/PdfjsChromeUtils.jsm index f24f4abb4..b830f3dfd 100644 --- a/extensions/firefox/content/PdfjsChromeUtils.jsm +++ b/extensions/firefox/content/PdfjsChromeUtils.jsm @@ -272,7 +272,18 @@ let PdfjsChromeUtils = { */ function PdfjsFindbarWrapper(aBrowser) { let tabbrowser = aBrowser.getTabBrowser(); - let tab = tabbrowser._getTabForBrowser(aBrowser); + let tab; +//#if MOZCENTRAL + tab = tabbrowser.getTabForBrowser(aBrowser); +//#else + if (tabbrowser.getTabForBrowser) { + tab = tabbrowser.getTabForBrowser(aBrowser); + } else { + // _getTabForBrowser is depreciated in Firefox 35, see + // https://bugzilla.mozilla.org/show_bug.cgi?id=1039500. + tab = tabbrowser._getTabForBrowser(aBrowser); + } +//#endif this._findbar = tabbrowser.getFindBar(tab); };