gorhill 9 years ago
parent
commit
7b651310b4
  1. 26
      platform/firefox/vapi-background.js

26
platform/firefox/vapi-background.js

@ -688,6 +688,11 @@ vAPI.tabs.open = function(details) {
} }
this.select(tab); this.select(tab);
// Update URL if fragment is different
if ( URI.equals(browser.currentURI) === false ) {
browser.loadURI(URI.asciiSpec);
}
return; return;
} }
} }
@ -1096,10 +1101,9 @@ var tabWatcher = (function() {
return; return;
} }
var tabContainer = null;
if ( tabBrowser.tabContainer ) {
tabContainer = tabBrowser.tabContainer;
}
// https://github.com/gorhill/uBlock/issues/574
// To keep in mind: not all browser windows are tab containers.
var tabContainer = tabBrowser.tabContainer;
if ( tabContainer ) { if ( tabContainer ) {
tabContainer.removeEventListener('TabOpen', onOpen); tabContainer.removeEventListener('TabOpen', onOpen);
tabContainer.removeEventListener('TabShow', onShow); tabContainer.removeEventListener('TabShow', onShow);
@ -1107,8 +1111,20 @@ var tabWatcher = (function() {
tabContainer.removeEventListener('TabSelect', onSelect); tabContainer.removeEventListener('TabSelect', onSelect);
} }
// https://github.com/gorhill/uBlock/issues/574
// To keep in mind: not all windows are tab containers,
// sometimes the window IS the tab.
var tabs;
if ( tabBrowser.tabs ) {
tabs = tabBrowser.tabs;
} else if ( tabBrowser.localName === 'browser' ) {
tabs = [tabBrowser];
} else {
tabs = [];
}
var browser, URI, tabId; var browser, URI, tabId;
for ( var tab of tabBrowser.tabs ) {
for ( var tab of tabs ) {
browser = tabWatcher.browserFromTarget(tab); browser = tabWatcher.browserFromTarget(tab);
if ( browser === null ) { if ( browser === null ) {
continue; continue;

Loading…
Cancel
Save