1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-07-08 12:57:57 +02:00
This commit is contained in:
gorhill 2015-09-14 11:28:33 -04:00
parent 6cc07a4027
commit bc287f98aa
2 changed files with 15 additions and 5 deletions

View File

@ -432,7 +432,7 @@ LocationChangeListener.prototype.onLocationChange = function(webProgress, reques
}
this.messageManager.sendAsyncMessage(locationChangedMessageName, {
url: location.asciiSpec,
flags: flags,
flags: flags
});
};

View File

@ -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}, {