diff options
-rw-r--r-- | platform/firefox/frameModule.js | 2 | ||||
-rw-r--r-- | platform/firefox/vapi-background.js | 18 |
2 files changed, 15 insertions, 5 deletions
diff --git a/platform/firefox/frameModule.js b/platform/firefox/frameModule.js index 65de7a9..a11720e 100644 --- a/platform/firefox/frameModule.js +++ b/platform/firefox/frameModule.js @@ -432,7 +432,7 @@ LocationChangeListener.prototype.onLocationChange = function(webProgress, reques } this.messageManager.sendAsyncMessage(locationChangedMessageName, { url: location.asciiSpec, - flags: flags, + flags: flags }); }; diff --git a/platform/firefox/vapi-background.js b/platform/firefox/vapi-background.js index f4d5239..c69b998 100644 --- a/platform/firefox/vapi-background.js +++ b/platform/firefox/vapi-background.js @@ -1035,7 +1035,11 @@ var tabWatcher = (function() { vAPI.toolbarButton.attachToNewWindow(window); } - tabContainer.addEventListener('TabOpen', onOpen); + // https://github.com/gorhill/uBlock/issues/697 + // Ignore `TabShow` events: unfortunately the `pending` attribute is + // not set when a tab is opened as a result of session restore -- it is + // set *after* the event is fired in such case. + //tabContainer.addEventListener('TabOpen', onOpen); tabContainer.addEventListener('TabShow', onShow); tabContainer.addEventListener('TabClose', onClose); // when new window is opened TabSelect doesn't run on the selected tab? @@ -1912,8 +1916,16 @@ vAPI.net.registerListeners = function() { var locationChangedListenerMessageName = location.host + ':locationChanged'; var locationChangedListener = function(e) { - var details = e.data; var browser = e.target; + + // https://github.com/gorhill/uBlock/issues/697 + // Dismiss event if the associated tab is pending. + var tab = tabWatcher.tabFromBrowser(browser); + if ( !tab || tab.hasAttribute('pending') ) { + return; + } + + var details = e.data; var tabId = tabWatcher.tabIdFromTarget(browser); // Ignore notifications related to our popup @@ -1921,8 +1933,6 @@ vAPI.net.registerListeners = function() { return; } - //console.debug("nsIWebProgressListener: onLocationChange: " + details.url + " (" + details.flags + ")"); - // LOCATION_CHANGE_SAME_DOCUMENT = "did not load a new document" if ( details.flags & Ci.nsIWebProgressListener.LOCATION_CHANGE_SAME_DOCUMENT ) { vAPI.tabs.onUpdated(tabId, {url: details.url}, { |