[Firefox] Use getTabForBrowser instead of _getTabForBrowser if possible

This commit is contained in:
Jonas Jenwald 2014-10-10 22:26:52 +02:00
parent c8d729ff39
commit a34e7aa8fe
2 changed files with 24 additions and 2 deletions

View File

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

View File

@ -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);
};