Skip to content

Commit

Permalink
fix #1915: raciness of tab.url and soft nav
Browse files Browse the repository at this point in the history
  • Loading branch information
tophf committed Feb 12, 2025
1 parent aa8d134 commit 0f15b42
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions src/background/navigation-manager.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import '@/js/browser';
import {kAboutBlank, kUrl} from '@/js/consts';
import {kAboutBlank} from '@/js/consts';
import {CHROME, FIREFOX} from '@/js/ua';
import {chromeProtectsNTP, ownRoot} from '@/js/urls';
import {deepEqual} from '@/js/util';
Expand Down Expand Up @@ -50,17 +50,15 @@ async function onNavigation(navType, data) {
const td = tabCache[tabId];
if (td && navType !== kCommitted) {
const {frameId: f, url} = data;
if (td[kUrl]?.[f] !== url) {
const {documentId: d, frameType} = data;
sendTab(tabId, {
method: 'urlChanged',
top: !frameType && !f || frameType === 'outer_frame',
iid: !__.MV3 && td.iid?.[f] || 0,
url,
}, __.MV3 || d
? {documentId: d}
: {frameId: f});
}
const {documentId: d, frameType} = data;
sendTab(tabId, {
method: 'urlChanged',
top: !frameType && !f || frameType === 'outer_frame',
iid: !__.MV3 && td.iid?.[f] || 0,
url,
}, __.MV3 || d
? {documentId: d}
: {frameId: f});
}
for (const fn of onUrlChange) fn(data, navType);
}
Expand Down

0 comments on commit 0f15b42

Please sign in to comment.