1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-11-26 04:12:50 +01:00
This commit is contained in:
gorhill 2015-06-02 18:12:28 -04:00
parent 25070003bb
commit 8a73a093d9

View File

@ -742,9 +742,12 @@ var tabWatcher = (function() {
if ( tabbrowser === browser ) {
return 0;
}
return vAPI.fennec ?
tabbrowser.tabs.indexOf(browser) :
tabbrowser.browsers.indexOf(browser);
// Fennec
// https://developer.mozilla.org/en-US/Add-ons/Firefox_for_Android/API/BrowserApp
if ( vAPI.fennec ) {
return tabbrowser.tabs.indexOf(tabbrowser.getTabForBrowser(browser));
}
return tabbrowser.browsers.indexOf(browser);
};
var indexFromTarget = function(target) {
@ -975,7 +978,7 @@ var tabWatcher = (function() {
return {
start: start,
browserFromTarget: browserFromTarget,
tabs: function() { return browserToTabIdMap.keys(); },
browsers: function() { return browserToTabIdMap.keys(); },
tabIdFromTarget: tabIdFromTarget,
browserFromTabId: browserFromTabId,
indexFromTarget: indexFromTarget,
@ -1573,8 +1576,8 @@ vAPI.net.registerListeners = function() {
// Popup candidate
if ( details.openerURL ) {
for ( var tab of tabWatcher.tabs() ) {
var URI = tab.currentURI;
for ( var browser of tabWatcher.browsers() ) {
var URI = browser.currentURI;
// Probably isn't the best method to identify the source tab.
// Apparently URI can be undefined under some circumstances: I
@ -1585,7 +1588,7 @@ vAPI.net.registerListeners = function() {
continue;
}
sourceTabId = tabWatcher.tabIdFromTarget(tab);
sourceTabId = tabWatcher.tabIdFromTarget(browser);
if ( sourceTabId === tabId ) {
sourceTabId = null;
@ -2230,11 +2233,11 @@ vAPI.lastError = function() {
vAPI.onLoadAllCompleted = function() {
var µb = µBlock;
var tabId;
for ( var tab of tabWatcher.tabs() ) {
tabId = tabWatcher.tabIdFromTarget(tab);
µb.tabContextManager.commit(tabId, tab.currentURI.asciiSpec);
for ( var browser of tabWatcher.browsers() ) {
tabId = tabWatcher.tabIdFromTarget(browser);
µb.tabContextManager.commit(tabId, browser.currentURI.asciiSpec);
µb.bindTabToPageStats(tabId);
tab.messageManager.sendAsyncMessage(
browser.messageManager.sendAsyncMessage(
location.host + '-load-completed'
);
}