diff options
author | gorhill <rhill@raymondhill.net> | 2015-08-06 14:43:35 -0400 |
---|---|---|
committer | gorhill <rhill@raymondhill.net> | 2015-08-06 14:43:35 -0400 |
commit | 8e4f998a329998e3ce0d9b38e3abe72402092531 (patch) | |
tree | 47c7b22a9e8c0542932e4bb52cd2fe74f84f082e | |
parent | 980125b8afcf8d5d32eeeb39a2668fb32e454117 (diff) | |
download | uBlock-8e4f998a329998e3ce0d9b38e3abe72402092531.zip uBlock-8e4f998a329998e3ce0d9b38e3abe72402092531.tar.gz uBlock-8e4f998a329998e3ce0d9b38e3abe72402092531.tar.bz2 |
this fixes #574
-rw-r--r-- | platform/firefox/vapi-background.js | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/platform/firefox/vapi-background.js b/platform/firefox/vapi-background.js index 16d796b..a3cc5b0 100644 --- a/platform/firefox/vapi-background.js +++ b/platform/firefox/vapi-background.js @@ -1039,7 +1039,7 @@ var tabWatcher = (function() { return; } - var tabContainer = null; + var tabContainer; if ( tabBrowser.deck ) { // Fennec tabContainer = tabBrowser.deck; } else if ( tabBrowser.tabContainer ) { // Firefox @@ -1052,8 +1052,20 @@ var tabWatcher = (function() { 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; - for ( var tab of tabBrowser.tabs ) { + for ( var tab of tabs ) { browser = tabWatcher.browserFromTarget(tab); if ( browser === null ) { continue; |