Commit 2ca324e0 authored by Dennis Schubert's avatar Dennis Schubert Committed by mergify[bot]
Browse files

Bug 1714611 - Ship v24.0.0 of webcompat system addon.

parent 1c79eea1
......@@ -453,6 +453,35 @@ const AVAILABLE_INJECTIONS = [
],
},
},
{
id: "bug1714612",
platform: "all",
domain: "www.rfi.it",
bug: "1714612",
contentScripts: {
matches: ["*://www.rfi.it/*"],
js: [
{
file: "injections/js/bug1714612-www.rfi.it-outertext.js",
},
],
allFrames: true,
},
},
{
id: "bug1719870",
platform: "desktop",
domain: "lcbo.com",
bug: "1719870",
contentScripts: {
matches: ["*://*.lcbo.com/*"],
css: [
{
file: "injections/css/bug1719870-lcbo.com-table-clearfix.css",
},
],
},
},
];
module.exports = AVAILABLE_INJECTIONS;
......@@ -104,17 +104,8 @@ const AVAILABLE_SHIMS = [
name: "Ad Safe Protected Google IMA Adapter",
bug: "1508639",
file: "adsafeprotected-ima.js",
matches: [
"*://cdn.adsafeprotected.com/iasPET.1.js",
"*://static.adsafeprotected.com/vans-adapter-google-ima.js",
],
needsShimHelpers: ["optIn"],
matches: ["*://static.adsafeprotected.com/vans-adapter-google-ima.js"],
onlyIfBlockedByETP: true,
unblocksOnOptIn: [
"*://pubads.g.doubleclick.net/gampad/ads*",
"*://cdn.adsafeprotected.com/iasPET.1.js",
"*://static.adsafeprotected.com/vans-adapter-google-ima.js",
],
},
{
id: "AdsByGoogle",
......@@ -134,6 +125,47 @@ const AVAILABLE_SHIMS = [
matches: ["*://auth.9c9media.ca/auth/main.js"],
onlyIfBlockedByETP: true,
},
{
id: "Doubleclick",
platform: "all",
name: "Doubleclick",
bug: "1713693",
matches: [
{
patterns: [
"*://securepubads.g.doubleclick.net/gampad/*ad-blk*",
"*://pubads.g.doubleclick.net/gampad/*ad-blk*",
],
target: "empty-shim.txt",
types: ["image", "imageset", "xmlhttprequest"],
},
{
patterns: [
"*://securepubads.g.doubleclick.net/gampad/*xml_vmap1*",
"*://pubads.g.doubleclick.net/gampad/*xml_vmap1*",
],
target: "vmad.xml",
types: ["image", "imageset", "xmlhttprequest"],
},
{
patterns: [
"*://securepubads.g.doubleclick.net/gampad/*xml_vmap2*",
"*://pubads.g.doubleclick.net/gampad/*xml_vmap2*",
],
target: "vast2.xml",
types: ["image", "imageset", "xmlhttprequest"],
},
{
patterns: [
"*://securepubads.g.doubleclick.net/gampad/*ad*",
"*://pubads.g.doubleclick.net/gampad/*ad*",
],
target: "vast3.xml",
types: ["image", "imageset", "xmlhttprequest"],
},
],
onlyIfBlockedByETP: true,
},
{
id: "Eluminate",
platform: "all",
......@@ -183,12 +215,16 @@ const AVAILABLE_SHIMS = [
],
},
{
id: "GoogleAnalytics",
id: "GoogleAnalyticsAndTagManager",
platform: "all",
name: "Google Analytics",
bug: "1493602",
file: "google-analytics.js",
matches: ["*://www.google-analytics.com/analytics.js"],
name: "Google Analytics and Tag Manager",
bug: "1713687",
file: "google-analytics-and-tag-manager.js",
matches: [
"*://www.google-analytics.com/analytics.js*",
"*://www.google-analytics.com/gtm/js*",
"*://www.googletagmanager.com/gtm.js*",
],
onlyIfBlockedByETP: true,
},
{
......@@ -200,18 +236,6 @@ const AVAILABLE_SHIMS = [
matches: ["*://www.google-analytics.com/plugins/ua/ec.js"],
onlyIfBlockedByETP: true,
},
{
id: "GoogleAnalyticsTagManager",
platform: "all",
name: "Google Analytics Tag Manager",
bug: "1478593",
file: "google-analytics-tag-manager.js",
matches: [
"*://www.google-analytics.com/gtm/js",
"*://www.googletagmanager.com/gtm.js",
],
onlyIfBlockedByETP: true,
},
{
id: "GoogleAnalyticsLegacy",
platform: "all",
......@@ -221,11 +245,23 @@ const AVAILABLE_SHIMS = [
matches: ["*://ssl.google-analytics.com/ga.js"],
onlyIfBlockedByETP: true,
},
{
id: "GoogleIMA",
platform: "all",
name: "Google Interactive Media Ads",
bug: "1713690",
file: "google-ima.js",
matches: [
"*://s0.2mdn.net/instream/html5/ima3.js",
"*://imasdk.googleapis.com/js/sdkloader/ima3.js",
],
onlyIfBlockedByETP: true,
},
{
id: "GooglePublisherTags",
platform: "all",
name: "Google Publisher Tags",
bug: "1600538",
bug: "1713685",
file: "google-publisher-tags.js",
matches: [
"*://www.googletagservices.com/tag/js/gpt.js",
......@@ -234,18 +270,6 @@ const AVAILABLE_SHIMS = [
],
onlyIfBlockedByETP: true,
},
{
id: "IMA3",
platform: "all",
name: "IMA3",
bug: "1487373",
file: "empty-script.js",
onlyIfBlockedByETP: true,
matches: [
"*://s0.2mdn.net/instream/html5/ima3.js",
"*://imasdk.googleapis.com/js/sdkloader/ima3.js",
],
},
{
id: "Rambler",
platform: "all",
......@@ -260,7 +284,7 @@ const AVAILABLE_SHIMS = [
id: "RichRelevance",
platform: "all",
name: "Rich Relevance",
bug: "1449347",
bug: "1713725",
file: "rich-relevance.js",
matches: ["*://media.richrelevance.com/rrserver/js/1.2/p13n.js"],
onlyIfBlockedByETP: true,
......
......@@ -312,28 +312,6 @@ const AVAILABLE_UA_OVERRIDES = [
},
},
},
{
/*
* Bug 1577250 - UA override for homebook.pl on Firefox for Android
* WebCompat issue #24044 - https://webcompat.com/issues/24044
*
* homebook.pl shows desktop site on Firefox for Android based on
* UA detection. Spoofing as Chrome allows to get mobile site.
*/
id: "bug1577250",
platform: "android",
domain: "homebook.pl",
bug: "1577250",
config: {
matches: ["*://*.homebook.pl/*"],
uaTransformer: originalUA => {
return (
UAHelpers.getPrefix(originalUA) +
" AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.111 Mobile Safari/537.36"
);
},
},
},
{
/*
* Bug 1577267 - UA override for metfone.com.kh on Firefox for Android
......@@ -597,25 +575,6 @@ const AVAILABLE_UA_OVERRIDES = [
},
},
},
{
/*
* Bug 1679869 - Add UA override for vh1.com
* Webcompat issue #52755 - https://webcompat.com/issues/52755
*
* The site is not showing videos on Firefox on mobile stating
* that android 4.4.4 and chrome browser required
*/
id: "bug1679869",
platform: "android",
domain: "vh1.com",
bug: "1679869",
config: {
matches: ["*://*.vh1.com/*"],
uaTransformer: () => {
return UAHelpers.getDeviceAppropriateChromeUA();
},
},
},
{
/*
* Bug 1693827 - Add UA override for www.spectrum.net/voice/
......@@ -695,6 +654,83 @@ const AVAILABLE_UA_OVERRIDES = [
},
},
},
{
/*
* Bug 1719841 - Add UA override for appmedia.jp
* Webcompat issue #78939 - https://webcompat.com/issues/78939
*
* The sites shows Firefox a desktop version. With Chrome's UA string,
* we see a working mobile layout.
*/
id: "bug1719841",
platform: "android",
domain: "appmedia.jp",
bug: "1719841",
config: {
matches: ["*://appmedia.jp/*"],
uaTransformer: () => {
return UAHelpers.getDeviceAppropriateChromeUA();
},
},
},
{
/*
* Bug 1719842 - Add UA override for www.gouletpens.com
* Webcompat issue #77723 - https://webcompat.com/issues/77723
*
* The slider is not working in Firefox for Android due to some UA sniffing
* code path. It works if we spoof as Chrome for Android.
*/
id: "bug1719842",
platform: "android",
domain: "gouletpens.com",
bug: "1719842",
config: {
matches: ["*://*.gouletpens.com/*"],
uaTransformer: () => {
return UAHelpers.getDeviceAppropriateChromeUA();
},
},
},
{
/*
* Bug 1719846 - Add UA override for https://covid.cdc.gov/covid-data-tracker/
* Webcompat issue #76944 - https://webcompat.com/issues/76944
*
* The application locks out Firefox via User Agent sniffing, but in our
* tests, there appears to be no reason for this. Everything looks fine if
* we spoof as Chrome.
*/
id: "bug1719846",
platform: "all",
domain: "covid.cdc.gov",
bug: "1719846",
config: {
matches: ["*://covid.cdc.gov/covid-data-tracker/*"],
uaTransformer: () => {
return UAHelpers.getDeviceAppropriateChromeUA();
},
},
},
{
/*
* Bug 1719859 - Add UA override for saxoinvestor.fr
* Webcompat issue #74678 - https://webcompat.com/issues/74678
*
* The site blocks Firefox with a server-side UA sniffer. Appending a
* Chrome version segment to the UA makes it work.
*/
id: "bug1719859",
platform: "all",
domain: "saxoinvestor.fr",
bug: "1719859",
config: {
matches: ["*://*.saxoinvestor.fr/*"],
uaTransformer: originalUA => {
return originalUA + " Chrome/91.0.4472.114";
},
},
},
];
const UAHelpers = {
......
/**
* lcbo.com - Table with locations is not showing.
* Bug #1719870 - https://bugzilla.mozilla.org/show_bug.cgi?id=1719870
* WebCompat issue #75137 - https://webcompat.com/issues/75137
*/
.physicalStoreInventoryPage .scrollX {
clear: both;
}
"use strict";
/**
* Bug 1714612 - Build site patch for www.rfi.it
* WebCompat issue #155672 - https://webcompat.com/issues/55672
*
* This site patch polyfills HTML outerText, as the page relies on it to function
* properly (the map will not pan properly after zooming in).
*/
/* globals exportFunction */
console.info(
"HTML outerText has been polyfilled for compatibility reasons. See https://webcompat.com/issues/55672 for details."
);
Object.defineProperty(
window.wrappedJSObject.HTMLElement.prototype,
"outerText",
{
get: exportFunction(function() {
return this.innerText;
}, window),
set: exportFunction(function(value) {
this.replaceWith(document.createTextNode(value));
}, window),
}
);
......@@ -2,7 +2,7 @@
"manifest_version": 2,
"name": "Mozilla Android Components - Web Compatibility Interventions",
"description": "Urgent post-release fixes for web compatibility.",
"version": "23.3.0",
"version": "24.0.0",
"applications": {
"gecko": {
......@@ -94,12 +94,13 @@
"shims/bmauth.js",
"shims/eluminate.js",
"shims/empty-script.js",
"shims/empty-shim.txt",
"shims/facebook-sdk.js",
"shims/facebook.svg",
"shims/google-analytics-and-tag-manager.js",
"shims/google-analytics-ecommerce-plugin.js",
"shims/google-analytics-legacy.js",
"shims/google-analytics-tag-manager.js",
"shims/google-analytics.js",
"shims/google-ima.js",
"shims/google-publisher-tags.js",
"shims/live-test-shim.js",
"shims/mochitest-shim-1.js",
......@@ -108,6 +109,9 @@
"shims/play.svg",
"shims/rambler-authenticator.js",
"shims/rich-relevance.js",
"shims/tracking-pixel.png"
"shims/tracking-pixel.png",
"shims/vast2.xml",
"shims/vast3.xml",
"shims/vmad.xml"
]
}
......@@ -5,71 +5,15 @@
"use strict";
/**
* Bug 1508639 - Shim Ad Safe Protected's Google IMA adapter
*
* Sites relying on Ad Safe Protected's adapter for Google IMA may
* have broken videos when the script is blocked. This shim stubs
* out the API to help mitigate major breakage.
*/
if (!window.googleImaVansAdapter) {
const shimId = "AdSafeProtectedGoogleIMAAdapter";
const sendMessageToAddon = (function() {
const pendingMessages = new Map();
const channel = new MessageChannel();
channel.port1.onerror = console.error;
channel.port1.onmessage = event => {
const { messageId, response } = event.data;
const resolve = pendingMessages.get(messageId);
if (resolve) {
pendingMessages.delete(messageId);
resolve(response);
}
};
function reconnect() {
const detail = {
pendingMessages: [...pendingMessages.values()],
port: channel.port2,
shimId,
};
window.dispatchEvent(new CustomEvent("ShimConnects", { detail }));
}
window.addEventListener("ShimHelperReady", reconnect);
reconnect();
return function(message) {
const messageId =
Math.random()
.toString(36)
.substring(2) + Date.now().toString(36);
return new Promise(resolve => {
const payload = {
message,
messageId,
shimId,
};
pendingMessages.set(messageId, resolve);
channel.port1.postMessage(payload);
});
};
})();
window.googleImaVansAdapter = {
init: () => {},
dispose: () => {},
init() {},
dispose() {},
};
if (document.domain === "www.nhl.com") {
// Treat it as an opt-in when the user clicks on a video
// TODO: Improve this! It races to tell the bg script to unblock the ad from
// https://pubads.g.doubleclick.net/gampad/ads before the page loads them.
async function click(e) {
if (
e.isTrusted &&
e.target.closest(
"#video-player, .video-preview, article:not([data-video-url=''])"
)
) {
document.documentElement.removeEventListener("click", click, true);
await sendMessageToAddon("optIn");
}
}
document.documentElement.addEventListener("click", click, true);
}
}
/* 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";
/**
* Bug 1713687 - Shim Google Analytics and Tag Manager
*
* Sites often rely on the Google Analytics window object and will
* break if it fails to load or is blocked. This shim works around
* such breakage.
*
* Sites also often use the Google Optimizer (asynchide) code snippet,
* only for it to cause multi-second delays if Google Analytics does
* not load. This shim also avoids such delays.
*
* They also rely on Google Tag Manager, which often goes hand-in-
* hand with Analytics, but is not always blocked by anti-tracking
* lists. Handling both in the same shim handles both cases.
*/
if (window[window.GoogleAnalyticsObject || "ga"]?.loaded === undefined) {
const DEFAULT_TRACKER_NAME = "t0";
const trackers = new Map();
const run = function(fn, ...args) {
if (typeof fn === "function") {
try {
fn(...args);
} catch (e) {
console.error(e);
}
}
};
const create = (id, cookie, name, opts) => {
id = id || opts?.trackerId;
if (!id) {
return undefined;
}
cookie = cookie || opts?.cookieDomain || "_ga";
name = name || opts?.name || DEFAULT_TRACKER_NAME;
if (!trackers.has(name)) {
let props;
try {
props = new Map(Object.entries(opts));
} catch (_) {
props = new Map();
}
trackers.set(name, {
get(p) {
if (p === "name") {
return name;
} else if (p === "trackingId") {
return id;
} else if (p === "cookieDomain") {
return cookie;
}
return props.get(p);
},
ma() {},
requireSync() {},
send() {},
set(p, v) {
if (typeof p !== "object") {
p = Object.fromEntries([[p, v]]);
}
for (const k in p) {
props.set(k, p[k]);
if (k === "hitCallback") {
run(p[k]);
}
}
},
});