Skip to content
This repository was archived by the owner on Sep 9, 2022. It is now read-only.

Commit 738c695

Browse files
committed
Merge pull request #1150 from AlexVallat/master
Candidate for fix for #1140
2 parents 2c707e1 + 8ea7dc5 commit 738c695

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

platform/firefox/frameModule.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,15 @@ const contentObserver = {
293293
let docReady = (e) => {
294294
let doc = e.target;
295295
doc.removeEventListener(e.type, docReady, true);
296+
297+
// 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
298+
let messageManager = doc.docShell.getInterface(Ci.nsIContentFrameMessageManager);
299+
300+
messageManager.sendSyncMessage(locationChangedMessageName, {
301+
url: loc.href,
302+
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
303+
});
304+
296305
lss(this.contentBaseURI + 'contentscript-end.js', sandbox);
297306

298307
if ( doc.querySelector('a[href^="abp:"]') ) {

platform/firefox/vapi-background.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1325,6 +1325,12 @@ vAPI.net.registerListeners = function() {
13251325
var locationChangedListener = function(e) {
13261326
var details = e.data;
13271327
var browser = e.target;
1328+
1329+
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
1330+
//console.debug("nsIWebProgressListener: ignoring onLocationChange: " + details.url);
1331+
return;
1332+
}
1333+
13281334
var tabId = vAPI.tabs.getTabId(browser);
13291335
if (tabId === vAPI.noTabId) {
13301336
return; // Do not navigate for behind the scenes

0 commit comments

Comments
 (0)