trust sender's URL in FF

fixes #1194
This commit is contained in:
tophf 2021-02-28 18:01:26 +03:00
parent 01e2e09fa5
commit a56e528b31

View File

@ -1,5 +1,5 @@
/* global API msg */// msg.js /* global API msg */// msg.js
/* global URLS stringAsRegExp tryRegExp */// toolbox.js /* global CHROME URLS stringAsRegExp tryRegExp */// toolbox.js
/* global bgReady compareRevision */// common.js /* global bgReady compareRevision */// common.js
/* global calcStyleDigest styleCodeEmpty styleSectionGlobal */// sections-util.js /* global calcStyleDigest styleCodeEmpty styleSectionGlobal */// sections-util.js
/* global db */ /* global db */
@ -128,10 +128,13 @@ const styleMan = (() => {
if (isInitialApply && prefs.get('disableAll')) { if (isInitialApply && prefs.get('disableAll')) {
return {disableAll: true}; return {disableAll: true};
} }
/* Chrome hides text frament from location.href of the page e.g. #:~:text=foo if (CHROME && this && this.sender) {
so we'll use the real URL reported by webNavigation API */ /* Chrome hides text frament from location.href of the page e.g. #:~:text=foo
const {tab, frameId} = this && this.sender || {}; so we'll use the real URL reported by webNavigation API.
url = tab && tabMan.get(tab.id, 'url', frameId) || url; TODO: if FF will do the same, this won't work as is: FF reports onCommitted too late */
const {tab, frameId} = this.sender;
url = tab && tabMan.get(tab.id, 'url', frameId) || url;
}
let cache = cachedStyleForUrl.get(url); let cache = cachedStyleForUrl.get(url);
if (!cache) { if (!cache) {
cache = { cache = {