зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1862225 - UA override change for tesco.com r=webcompat-reviewers,twisniewski
Differential Revision: https://phabricator.services.mozilla.com/D192387
This commit is contained in:
Родитель
d1fdbeef03
Коммит
fa47434bc1
|
@ -1379,21 +1379,20 @@ const AVAILABLE_UA_OVERRIDES = [
|
|||
},
|
||||
{
|
||||
/*
|
||||
* Bug 1858664 - UA override to freeze rv segment to 109
|
||||
* Bug 1858664 - UA override for tesco.com
|
||||
*
|
||||
* Some sites have issues with a UA string with "rv:" segment
|
||||
* higher than 109, freezing it to 109 fixes the issues.
|
||||
* tesco.com shows access denied with a UA string with "rv:" segment
|
||||
* higher than 109, and version higher than 120.
|
||||
*/
|
||||
id: "bug1858664",
|
||||
platform: "all",
|
||||
domain: "Sites with known breakage with rv: segment higher than 109",
|
||||
domain: "tesco.com",
|
||||
bug: "1858664",
|
||||
config: {
|
||||
matches: [
|
||||
"*://*.tesco.com/*", // #1858664
|
||||
],
|
||||
matches: ["*://*.tesco.com/*"],
|
||||
uaTransformer: originalUA => {
|
||||
return UAHelpers.capRvTo109(originalUA);
|
||||
const cappedRv = UAHelpers.capRvTo109(originalUA);
|
||||
return UAHelpers.capVersionToNumber(cappedRv);
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
|
@ -79,6 +79,14 @@ var UAHelpers = {
|
|||
}
|
||||
return originalUA.replace(`rv:${ver[1]}`, "rv:109.0");
|
||||
},
|
||||
capVersionToNumber(originalUA, cap = 120) {
|
||||
const ver = originalUA.match(/Firefox\/(\d+\.\d+)/);
|
||||
if (!ver || parseFloat(ver[1]) <= cap) {
|
||||
return originalUA;
|
||||
}
|
||||
const capped = `Firefox/${cap}.0`;
|
||||
return originalUA.replace(`Firefox/${ver[1]}`, capped);
|
||||
},
|
||||
getWindowsUA(originalUA) {
|
||||
const rv = originalUA.match("rv:[0-9]+.[0-9]+")[0];
|
||||
const ver = originalUA.match("Firefox/[0-9]+.[0-9]+")[0];
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
"manifest_version": 2,
|
||||
"name": "Web Compatibility Interventions",
|
||||
"description": "Urgent post-release fixes for web compatibility.",
|
||||
"version": "120.0.0",
|
||||
"version": "120.1.0",
|
||||
"browser_specific_settings": {
|
||||
"gecko": {
|
||||
"id": "webcompat@mozilla.org",
|
||||
|
|
Загрузка…
Ссылка в новой задаче