Bug 1720140 - Ship v27.0.0 of the WebCompat System Addon; r=denschub,webcompat-reviewers

Differential Revision: https://phabricator.services.mozilla.com/D126816
This commit is contained in:
Thomas Wisniewski
2021-09-28 17:47:04 +00:00
parent 139fbd1a5b
commit b39921c8ab
9 changed files with 97 additions and 152 deletions

View File

@@ -246,20 +246,6 @@ const AVAILABLE_INJECTIONS = [
],
},
},
{
id: "bug1645064",
platform: "desktop",
domain: "s-kanava.fi",
bug: "1645064",
contentScripts: {
matches: ["https://www.s-kanava.fi/*"],
css: [
{
file: "injections/css/bug1645064-s-kanava.fi-invisible-charts.css",
},
],
},
},
{
id: "bug1651917",
platform: "android",
@@ -473,6 +459,24 @@ const AVAILABLE_INJECTIONS = [
],
},
},
{
id: "bug1722955",
platform: "android",
domain: "frontgate.com",
bug: "1722955",
contentScripts: {
matches: ["*://*.frontgate.com/*"],
js: [
{
file: "lib/ua_helpers.js",
},
{
file: "injections/js/bug1722955-frontgate.com-ua-override.js",
},
],
allFrames: true,
},
},
{
id: "bug1724764",
platform: "android",

View File

@@ -10,6 +10,9 @@
if (typeof InterventionHelpers === "undefined") {
var InterventionHelpers = require("../lib/intervention_helpers");
}
if (typeof UAHelpers === "undefined") {
var UAHelpers = require("../lib/ua_helpers");
}
/**
* For detailed information on our policies, and a documention on this format
@@ -36,18 +39,18 @@ const AVAILABLE_UA_OVERRIDES = [
},
{
/*
* Bug 1577519 - att.tv - Create a UA override for att.tv for playback on desktop
* Bug 1577519 - directv.com - Create a UA override for directv.com for playback on desktop
* WebCompat issue #3846 - https://webcompat.com/issues/3846
*
* att.tv (atttvnow.com) is blocking Firefox via UA sniffing. Spoofing as Chrome allows
* directv.com (attwatchtv.com) is blocking Firefox via UA sniffing. Spoofing as Chrome allows
* to access the site and playback works fine. This is former directvnow.com
*/
id: "bug1577519",
platform: "desktop",
domain: "att.tv",
domain: "directv.com",
bug: "1577519",
config: {
matches: ["*://*.att.tv/*"],
matches: ["*://*.directv.com/*", "*://*.attwatchtv.com/*"],
uaTransformer: originalUA => {
return (
UAHelpers.getPrefix(originalUA) +
@@ -122,35 +125,6 @@ const AVAILABLE_UA_OVERRIDES = [
},
},
},
{
/*
* Bug 945963 - tieba.baidu.com serves simplified mobile content to Firefox Android
* additionally, Bug 1525839 for more domains
* WebCompat issue #18455 - https://webcompat.com/issues/18455
*
* tieba.baidu.com and tiebac.baidu.com serve a heavily simplified and less functional
* mobile experience to Firefox for Android users. Adding the AppleWebKit indicator
* to the User Agent gets us the same experience.
*/
id: "bug945963",
platform: "android",
domain: "tieba.baidu.com",
bug: "945963",
config: {
matches: [
"*://baike.baidu.com/*",
"*://image.baidu.com/*",
"*://news.baidu.com/*",
"*://tieba.baidu.com/*",
"*://tiebac.baidu.com/*",
"*://wenku.baidu.com/*",
"*://zhidao.baidu.com/*",
],
uaTransformer: originalUA => {
return UAHelpers.getDeviceAppropriateChromeUA();
},
},
},
{
/*
* Bug 1177298 - Write UA overrides for top Japanese Sites
@@ -537,47 +511,6 @@ const AVAILABLE_UA_OVERRIDES = [
},
},
},
{
/*
* Bug 1679847 - Add UA override for avto.pro
* Webcompat issue #60043 - https://webcompat.com/issues/60043
*
* Unless Chrome is in the UA, the site serves a desktop version
* on catalog pages
*/
id: "bug1679847",
platform: "android",
domain: "avto.pro",
bug: "1679847",
config: {
matches: ["https://avto.pro/catalog/*"],
uaTransformer: () => {
return UAHelpers.getDeviceAppropriateChromeUA();
},
},
},
{
/*
* Bug 1693827 - Add UA override for www.spectrum.net/voice/
* Webcompat issue https://bugzilla.mozilla.org/show_bug.cgi?id=1546167
*
* The site is not allowing Firefox users to download
* voice messages based on UA detection. Chrome UA is required.
*/
id: "bug1693827",
platform: "desktop",
domain: "spectrum.net",
bug: "1693827",
config: {
matches: ["*://*.spectrum.net/voice/*"],
uaTransformer: originalUA => {
return (
UAHelpers.getPrefix(originalUA) +
" AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36"
);
},
},
},
{
/*
* Bug 1704673 - Add UA override for app.xiaomi.com
@@ -674,25 +607,6 @@ const AVAILABLE_UA_OVERRIDES = [
},
},
},
{
/*
* Bug 1722955 - Add UA override for frontgate.com
* Webcompat issue #36277 - https://github.com/webcompat/web-bugs/issues/36277
*
* The website is sending the desktop version to Firefox on mobile devices
* based on UA sniffing. Spoofing as Chrome fixes this.
*/
id: "bug1722955",
platform: "android",
domain: "frontgate.com",
bug: "1722955",
config: {
matches: ["*://frontgate.com/*"],
uaTransformer: () => {
return UAHelpers.getDeviceAppropriateChromeUA();
},
},
},
{
/*
* Bug 1722954 - Add UA override for game.granbluefantasy.jp
@@ -714,30 +628,4 @@ const AVAILABLE_UA_OVERRIDES = [
},
];
const UAHelpers = {
getDeviceAppropriateChromeUA() {
if (!UAHelpers._deviceAppropriateChromeUA) {
const userAgent =
typeof navigator !== "undefined" ? navigator.userAgent : "";
const RunningFirefoxVersion = (userAgent.match(/Firefox\/([0-9.]+)/) || [
"",
"58.0",
])[1];
const RunningAndroidVersion =
userAgent.match(/Android\/[0-9.]+/) || "Android 6.0";
const ChromeVersionToMimic = "76.0.3809.111";
const ChromePhoneUA = `Mozilla/5.0 (Linux; ${RunningAndroidVersion}; Nexus 5 Build/MRA58N) FxQuantum/${RunningFirefoxVersion} AppleWebKit/537.36 (KHTML, like Gecko) Chrome/${ChromeVersionToMimic} Mobile Safari/537.36`;
const ChromeTabletUA = `Mozilla/5.0 (Linux; ${RunningAndroidVersion}; Nexus 7 Build/JSS15Q) FxQuantum/${RunningFirefoxVersion} AppleWebKit/537.36 (KHTML, like Gecko) Chrome/${ChromeVersionToMimic} Safari/537.36`;
const IsPhone = userAgent.includes("Mobile");
UAHelpers._deviceAppropriateChromeUA = IsPhone
? ChromePhoneUA
: ChromeTabletUA;
}
return UAHelpers._deviceAppropriateChromeUA;
},
getPrefix(originalUA) {
return originalUA.substr(0, originalUA.indexOf(")") + 1);
},
};
module.exports = AVAILABLE_UA_OVERRIDES;

View File

@@ -7,10 +7,12 @@
"name": "isDFPIActive",
"type": "function",
"description": "Returns whether dFPI is active for private/non-private browsing tabs",
"parameters": [{
"type": "boolean",
"name": "isPrivate"
}],
"parameters": [
{
"type": "boolean",
"name": "isPrivate"
}
],
"async": true
},
{

View File

@@ -1,12 +0,0 @@
/**
* s-kanava.fi - The tables carousel is missing
* Bug #1645064 - https://bugzilla.mozilla.org/show_bug.cgi?id=1645064
* WebCompat issue #53584 - https://webcompat.com/issues/53584
*
* This site runs into a known Flex issue, see bug 1469649. However, the issue
* is easy to workaround in this case by explicitly specifying the width of
* the flex container.
*/
.carousel .slider-wrapper.axis-horizontal .slider .slide {
max-width: 100%;
}

View File

@@ -0,0 +1,17 @@
"use strict";
/*
* Bug 1722955 - Add UA override for frontgate.com
* Webcompat issue #36277 - https://github.com/webcompat/web-bugs/issues/36277
*
* The website is sending the desktop version to Firefox on mobile devices
* based on UA sniffing. Spoofing as Chrome fixes this.
*/
/* globals exportFunction, UAHelpers */
console.info(
"The user agent has been overridden for compatibility reasons. See https://webcompat.com/issues/36277 for details."
);
UAHelpers.overrideWithDeviceAppropriateChromeUA();

View File

@@ -0,0 +1,44 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
/* globals exportFunction, module */
const UAHelpers = {
getDeviceAppropriateChromeUA() {
if (!UAHelpers._deviceAppropriateChromeUA) {
const userAgent =
typeof navigator !== "undefined" ? navigator.userAgent : "";
const RunningFirefoxVersion = (userAgent.match(/Firefox\/([0-9.]+)/) || [
"",
"58.0",
])[1];
const RunningAndroidVersion =
userAgent.match(/Android\/[0-9.]+/) || "Android 6.0";
const ChromeVersionToMimic = "76.0.3809.111";
const ChromePhoneUA = `Mozilla/5.0 (Linux; ${RunningAndroidVersion}; Nexus 5 Build/MRA58N) FxQuantum/${RunningFirefoxVersion} AppleWebKit/537.36 (KHTML, like Gecko) Chrome/${ChromeVersionToMimic} Mobile Safari/537.36`;
const ChromeTabletUA = `Mozilla/5.0 (Linux; ${RunningAndroidVersion}; Nexus 7 Build/JSS15Q) FxQuantum/${RunningFirefoxVersion} AppleWebKit/537.36 (KHTML, like Gecko) Chrome/${ChromeVersionToMimic} Safari/537.36`;
const IsPhone = userAgent.includes("Mobile");
UAHelpers._deviceAppropriateChromeUA = IsPhone
? ChromePhoneUA
: ChromeTabletUA;
}
return UAHelpers._deviceAppropriateChromeUA;
},
getPrefix(originalUA) {
return originalUA.substr(0, originalUA.indexOf(")") + 1);
},
overrideWithDeviceAppropriateChromeUA() {
const chromeUA = UAHelpers.getDeviceAppropriateChromeUA();
Object.defineProperty(window.navigator.wrappedJSObject, "userAgent", {
get: exportFunction(() => chromeUA, window),
set: exportFunction(function() {}, window),
});
},
};
if (typeof module !== "undefined") {
module.exports = UAHelpers;
}

View File

@@ -2,7 +2,7 @@
"manifest_version": 2,
"name": "Web Compatibility Interventions",
"description": "Urgent post-release fixes for web compatibility.",
"version": "26.4.0",
"version": "27.0.0",
"applications": {
"gecko": {
"id": "webcompat@mozilla.org",
@@ -76,6 +76,7 @@
"lib/module_shim.js",
"lib/messaging_helper.js",
"lib/intervention_helpers.js",
"lib/ua_helpers.js",
"data/injections.js",
"data/shims.js",
"data/ua_overrides.js",

View File

@@ -50,7 +50,6 @@ FINAL_TARGET_FILES.features["webcompat@mozilla.org"]["injections"]["css"] += [
"injections/css/bug1605611-maps.google.com-directions-time.css",
"injections/css/bug1610344-directv.com.co-hide-unsupported-message.css",
"injections/css/bug1644830-missingmail.usps.com-checkboxes-not-visible.css",
"injections/css/bug1645064-s-kanava.fi-invisible-charts.css",
"injections/css/bug1651917-teletrader.com.body-transform-origin.css",
"injections/css/bug1653075-livescience.com-scrollbar-width.css",
"injections/css/bug1654877-preev.com-moz-appearance-fix.css",
@@ -76,6 +75,7 @@ FINAL_TARGET_FILES.features["webcompat@mozilla.org"]["injections"]["js"] += [
"injections/js/bug1631811-datastudio.google.com-indexedDB.js",
"injections/js/bug1711082-m.aliexpress.com-undisable-search.js",
"injections/js/bug1714612-www.rfi.it-outertext.js",
"injections/js/bug1722955-frontgate.com-ua-override.js",
"injections/js/bug1724764-amextravel.com-window-print.js",
"injections/js/bug1724868-news.yahoo.co.jp-ua-override.js",
"injections/js/bug1731825-office365-email-handling-prompt-autohide.js",
@@ -131,6 +131,7 @@ FINAL_TARGET_FILES.features["webcompat@mozilla.org"]["lib"] += [
"lib/module_shim.js",
"lib/shim_messaging_helper.js",
"lib/shims.js",
"lib/ua_helpers.js",
"lib/ua_overrides.js",
]

View File

@@ -15,7 +15,7 @@
*/
console.info(
`Service Workers are disabled by Firefox on this page due to https://bugzilla.mozilla.org/show_bug.cgi?id=1668408 for details.`
"Service Workers are disabled by Firefox on this page due to https://bugzilla.mozilla.org/show_bug.cgi?id=1668408 for details."
);
delete window.navigator.wrappedJSObject.__proto__.serviceWorker;