Fix: update tab icon on forward/backward
This commit is contained in:
parent
f08faea149
commit
43afa31fa0
|
@ -147,11 +147,18 @@ prefs.initializing.then(() => {
|
|||
refreshAllIcons();
|
||||
});
|
||||
|
||||
navigatorUtil.onUrlChange(({tabId, frameId}, type) => {
|
||||
navigatorUtil.onUrlChange(({tabId, frameId, transitionQualifiers}, type) => {
|
||||
if (type === 'committed' && !frameId) {
|
||||
// it seems that the tab icon would be reset when pressing F5. We
|
||||
// invalidate the cache here so it would be refreshed.
|
||||
// it seems that the tab icon would be reset by navigation. We
|
||||
// invalidate the cache here so it would be refreshed by `apply.js`.
|
||||
tabIcons.delete(tabId);
|
||||
|
||||
// however, if the tab was swapped in by forward/backward buttons,
|
||||
// `apply.js` doesn't notify the background to update the icon,
|
||||
// so we have to refresh it manually.
|
||||
if (transitionQualifiers.includes('forward_back')) {
|
||||
msg.sendTab(tabId, {method: 'updateCount'}).catch(msg.broadcastError);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -23,16 +23,19 @@ const navigatorUtil = (() => {
|
|||
chrome.webNavigation.onCommitted.addListener(data =>
|
||||
fixNTPUrl(data)
|
||||
.then(() => executeCallbacks(handler.urlChange, data, 'committed'))
|
||||
.catch(console.error)
|
||||
);
|
||||
|
||||
chrome.webNavigation.onHistoryStateUpdated.addListener(data =>
|
||||
fixNTPUrl(data)
|
||||
.then(() => executeCallbacks(handler.urlChange, data, 'historyStateUpdated'))
|
||||
.catch(console.error)
|
||||
);
|
||||
|
||||
chrome.webNavigation.onReferenceFragmentUpdated.addListener(data =>
|
||||
fixNTPUrl(data)
|
||||
.then(() => executeCallbacks(handler.urlChange, data, 'referenceFragmentUpdated'))
|
||||
.catch(console.error)
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -219,6 +219,10 @@ const APPLY = (() => {
|
|||
}
|
||||
});
|
||||
break;
|
||||
|
||||
case 'updateCount':
|
||||
updateCount();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -336,11 +340,6 @@ const APPLY = (() => {
|
|||
}
|
||||
docRootObserver.firstStart();
|
||||
|
||||
// FIXME
|
||||
// if (FF_BUG461 && (gotNewStyles || styles.needTransitionPatch)) {
|
||||
// setContentsInPageContext();
|
||||
// }
|
||||
|
||||
if (!isOwnPage && !docRewriteObserver && styleElements.size) {
|
||||
initDocRewriteObserver();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user