Unspoofable browser version detection.

This commit is contained in:
hackademix 2020-05-29 00:30:28 +02:00
parent 65ca612e56
commit 16f8856264
1 changed files with 5 additions and 1 deletions

View File

@ -533,7 +533,11 @@ var RequestGuard = (() => {
let filterAll = {urls: allUrls};
listen("onBeforeRequest", filterAll, ["blocking"]);
const mergingCSP = parseInt(navigator.userAgent.replace(/.*Firefox\/(\d+).*/, "$1")) >= 77;
let mergingCSP = "getBrowserInfo" in browser.runtime;
if (mergingCSP) {
let {vendor, version} = await browser.runtime.getBrowserInfo();
mergingCSP = vendor === "Mozilla" && parseInt(version) >= 77;
}
if (mergingCSP) {
// In Gecko>=77 (https://bugzilla.mozilla.org/show_bug.cgi?id=1462989)
// we need to cleanup our own cached headers in a dedicated listener :(