preserve iframe's sender.url

This commit is contained in:
tophf 2021-09-24 11:05:55 +03:00
parent fce049a911
commit 818031a86b

View File

@ -142,12 +142,12 @@ const styleMan = (() => {
if (isInitialApply && prefs.get('disableAll')) { if (isInitialApply && prefs.get('disableAll')) {
return {disableAll: true}; return {disableAll: true};
} }
if (CHROME && this && this.sender) { const sender = CHROME && this && this.sender || {};
if (sender.frameId === 0) {
/* Chrome hides text frament from location.href of the page e.g. #:~:text=foo /* Chrome hides text frament from location.href of the page e.g. #:~:text=foo
so we'll use the real URL reported by webNavigation API. so we'll use the real URL reported by webNavigation API.
TODO: if FF will do the same, this won't work as is: FF reports onCommitted too late */ TODO: if FF will do the same, this won't work as is: FF reports onCommitted too late */
const {tab, frameId} = this.sender; url = tabMan.get(sender.tab.id, 'url', 0) || url;
url = tab && tabMan.get(tab.id, 'url', frameId) || url;
} }
let cache = cachedStyleForUrl.get(url); let cache = cachedStyleForUrl.get(url);
if (!cache) { if (!cache) {