mirror of
https://github.com/gorhill/uBlock.git
synced 2024-11-16 23:42:39 +01:00
Merge pull request #1150 from AlexVallat/master
Candidate for fix for #1140
This commit is contained in:
commit
738c695af8
@ -293,6 +293,15 @@ const contentObserver = {
|
||||
let docReady = (e) => {
|
||||
let doc = e.target;
|
||||
doc.removeEventListener(e.type, docReady, true);
|
||||
|
||||
// It is possible, in some cases (#1140) for document-element-inserted to occur *before* nsIWebProgressListener.onLocationChange, so ensure that the URL is correct before continuing
|
||||
let messageManager = doc.docShell.getInterface(Ci.nsIContentFrameMessageManager);
|
||||
|
||||
messageManager.sendSyncMessage(locationChangedMessageName, {
|
||||
url: loc.href,
|
||||
noRefresh: true, // If the URL is the same, then don't refresh it so that if this occurs after onLocationChange, no the block count isn't reset
|
||||
});
|
||||
|
||||
lss(this.contentBaseURI + 'contentscript-end.js', sandbox);
|
||||
|
||||
if ( doc.querySelector('a[href^="abp:"]') ) {
|
||||
|
@ -1325,6 +1325,12 @@ vAPI.net.registerListeners = function() {
|
||||
var locationChangedListener = function(e) {
|
||||
var details = e.data;
|
||||
var browser = e.target;
|
||||
|
||||
if (details.noRefresh && details.url === browser.currentURI.asciiSpec) { // If the location changed message specified not to refresh, and the URL is the same, no need to do anything
|
||||
//console.debug("nsIWebProgressListener: ignoring onLocationChange: " + details.url);
|
||||
return;
|
||||
}
|
||||
|
||||
var tabId = vAPI.tabs.getTabId(browser);
|
||||
if (tabId === vAPI.noTabId) {
|
||||
return; // Do not navigate for behind the scenes
|
||||
|
Loading…
Reference in New Issue
Block a user