diff options
author | gorhill <rhill@raymondhill.net> | 2015-10-13 09:34:11 -0400 |
---|---|---|
committer | gorhill <rhill@raymondhill.net> | 2015-10-13 09:34:11 -0400 |
commit | 6424aee78888f741013f8fab57bfaf5b45ad5de7 (patch) | |
tree | 200ea738bd4b1673c88624a0f3a759d4ced19235 | |
parent | 24a9d91b710ca62b2789c8c5cbee89afa7e57b98 (diff) | |
download | uBlock-6424aee78888f741013f8fab57bfaf5b45ad5de7.zip uBlock-6424aee78888f741013f8fab57bfaf5b45ad5de7.tar.gz uBlock-6424aee78888f741013f8fab57bfaf5b45ad5de7.tar.bz2 |
this fixes #820
-rw-r--r-- | platform/firefox/vapi-background.js | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/platform/firefox/vapi-background.js b/platform/firefox/vapi-background.js index e21afdf..78840b2 100644 --- a/platform/firefox/vapi-background.js +++ b/platform/firefox/vapi-background.js @@ -1051,6 +1051,10 @@ var tabWatcher = (function() { } }; + var removeTarget = function(target) { + onClose({ target: target }); + }; + // https://developer.mozilla.org/en-US/docs/Web/Events/TabOpen //var onOpen = function({target}) { // var tabId = tabIdFromTarget(target); @@ -1246,6 +1250,7 @@ var tabWatcher = (function() { browserFromTarget: browserFromTarget, currentBrowser: currentBrowser, indexFromTarget: indexFromTarget, + removeTarget: removeTarget, start: start, tabFromBrowser: tabFromBrowser, tabIdFromTarget: tabIdFromTarget @@ -2050,10 +2055,22 @@ vAPI.net.registerListeners = function() { var locationChangedListener = function(e) { var browser = e.target; + // I have seen this happens (at startup time) + if ( !browser.currentURI ) { + return; + } + // https://github.com/gorhill/uBlock/issues/697 // Dismiss event if the associated tab is pending. var tab = tabWatcher.tabFromBrowser(browser); if ( !vAPI.fennec && tab && tab.hasAttribute('pending') ) { + // https://github.com/gorhill/uBlock/issues/820 + // Firefox quirk: it happens the `pending` attribute was not + // present for certain tabs at startup -- and this can cause + // unwanted [browser <--> tab id] associations internally. + // Dispose of these if it is found the `pending` attribute is + // set. + tabWatcher.removeTarget(tab); return; } |