1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-11-23 02:42:41 +01:00

Firefox: improve vAPI.tabs.getTabId

This commit is contained in:
Deathamns 2014-12-19 21:26:10 +01:00
parent c45b7c75e2
commit 85ee514ebc

View File

@ -360,8 +360,15 @@ vAPI.tabs.getTabId = function(target) {
return target.linkedPanel.slice(6);
}
var gBrowser = target.ownerDocument.defaultView.gBrowser;
var i = gBrowser.browsers.indexOf(target);
var i, gBrowser = target.ownerDocument.defaultView.gBrowser;
// This should be more efficient from version 35
if (gBrowser.getTabForBrowser) {
i = gBrowser.getTabForBrowser(target);
return i ? i.linkedPanel.slice(6) : -1;
}
i = gBrowser.browsers.indexOf(target);
if (i !== -1) {
i = gBrowser.tabs[i].linkedPanel.slice(6);