mirror of
https://github.com/gorhill/uBlock.git
synced 2024-11-23 02:42:41 +01:00
Merge pull request #1021 from AlexVallat/master
Fix for #1017 (and #1001)
This commit is contained in:
commit
38d308f1f0
@ -308,7 +308,8 @@ var tabWatcher = {
|
||||
|
||||
onTabSelect: function({target}) {
|
||||
// target is tab in Firefox, browser in Fennec
|
||||
var URI = (target.linkedBrowser || target).currentURI;
|
||||
var browser = (target.linkedBrowser || target);
|
||||
var URI = browser.currentURI;
|
||||
var aboutPath = URI.schemeIs('about') && URI.path;
|
||||
var tabId = vAPI.tabs.getTabId(target);
|
||||
|
||||
@ -317,11 +318,13 @@ var tabWatcher = {
|
||||
return;
|
||||
}
|
||||
|
||||
vAPI.tabs.onNavigation({
|
||||
frameId: 0,
|
||||
tabId: tabId,
|
||||
url: URI.asciiSpec
|
||||
});
|
||||
if ( browser.webNavigation.busyFlags === 0 /*BUSY_FLAGS_NONE*/ ) {
|
||||
vAPI.tabs.onNavigation({
|
||||
frameId: 0,
|
||||
tabId: tabId,
|
||||
url: URI.asciiSpec
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
onLocationChange: function(browser, webProgress, request, location, flags) {
|
||||
@ -452,15 +455,9 @@ vAPI.tabs.getTabId = function(target) {
|
||||
if ( vAPI.fennec ) {
|
||||
if ( target.browser ) {
|
||||
// target is a tab
|
||||
return target.id;
|
||||
}
|
||||
|
||||
for ( var win of this.getWindows() ) {
|
||||
var tab = win.BrowserApp.getTabForBrowser(target);
|
||||
if ( tab && tab.id !== undefined ) {
|
||||
return tab.id;
|
||||
}
|
||||
return target.browser.loadContext.DOMWindowID;
|
||||
}
|
||||
return target.loadContext.DOMWindowID;
|
||||
|
||||
return -1;
|
||||
}
|
||||
@ -513,7 +510,8 @@ vAPI.tabs.getTabsForIds = function(tabIds, tabBrowser) {
|
||||
|
||||
if ( vAPI.fennec ) {
|
||||
for ( tabId of tabIds ) {
|
||||
var tab = tabBrowser.getTabForId(tabId);
|
||||
|
||||
var tab = tabBrowser.tabs.find(tab=>tab.browser.loadContext.DOMWindowID === Number(tabId));
|
||||
if ( tab ) {
|
||||
tabs.push(tab);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user