From 62a5aa531338c3d2c1ee1c2e43a607ca66593d72 Mon Sep 17 00:00:00 2001 From: Thomas Wisniewski Date: Wed, 18 Oct 2023 16:28:46 +0000 Subject: [PATCH] Bug 1838841 - Ship v120.0.0 of the WebCompat System Addon; r=ksenia,webcompat-reviewers Differential Revision: https://phabricator.services.mozilla.com/D191233 --- .../extensions/webcompat/data/injections.js | 67 +++++-------------- .../extensions/webcompat/data/ua_overrides.js | 53 ++++++--------- ...605611-maps.google.com-directions-time.css | 16 ----- ...w.vivobarefoot.com-product-filters-fix.css | 17 ----- ...bug1829952-eventer.co.il-button-height.css | 18 ----- ...1605611-maps.google.com-directions-time.js | 38 ----------- .../bug1859617-installtrigger-removal-shim.js | 26 +++++++ .../extensions/webcompat/lib/ua_helpers.js | 7 ++ browser/extensions/webcompat/manifest.json | 2 +- browser/extensions/webcompat/moz.build | 5 +- .../tests/test_1605611_maps_google_com.py | 33 --------- .../tests/test_1799994_vivobarefoot_com.py | 63 ----------------- .../tests/test_1829952_eventer_co_il.py | 32 --------- .../test_1836181_conference_amwell_com.py | 24 ------- 14 files changed, 72 insertions(+), 329 deletions(-) delete mode 100644 browser/extensions/webcompat/injections/css/bug1605611-maps.google.com-directions-time.css delete mode 100644 browser/extensions/webcompat/injections/css/bug1799994-www.vivobarefoot.com-product-filters-fix.css delete mode 100644 browser/extensions/webcompat/injections/css/bug1829952-eventer.co.il-button-height.css delete mode 100644 browser/extensions/webcompat/injections/js/bug1605611-maps.google.com-directions-time.js create mode 100644 browser/extensions/webcompat/injections/js/bug1859617-installtrigger-removal-shim.js delete mode 100644 testing/webcompat/interventions/tests/test_1605611_maps_google_com.py delete mode 100644 testing/webcompat/interventions/tests/test_1799994_vivobarefoot_com.py delete mode 100644 testing/webcompat/interventions/tests/test_1829952_eventer_co_il.py delete mode 100644 testing/webcompat/interventions/tests/test_1836181_conference_amwell_com.py diff --git a/browser/extensions/webcompat/data/injections.js b/browser/extensions/webcompat/data/injections.js index c0716462cb2c..d079668f92a1 100644 --- a/browser/extensions/webcompat/data/injections.js +++ b/browser/extensions/webcompat/data/injections.js @@ -140,28 +140,6 @@ const AVAILABLE_INJECTIONS = [ ], }, }, - { - id: "bug1605611", - platform: "android", - domain: "maps.google.com", - bug: "1605611", - contentScripts: { - matches: InterventionHelpers.matchPatternsForGoogle( - "*://www.google.", - "/maps*" - ), - css: [ - { - file: "injections/css/bug1605611-maps.google.com-directions-time.css", - }, - ], - js: [ - { - file: "injections/js/bug1605611-maps.google.com-directions-time.js", - }, - ], - }, - }, { id: "bug1610344", platform: "all", @@ -484,6 +462,23 @@ const AVAILABLE_INJECTIONS = [ allFrames: true, }, }, + { + id: "bug1859617", + platform: "all", + domain: "Sites relying on there being no window.InstallTrigger", + bug: "1859617", + contentScripts: { + matches: [ + "*://*.stallionexpress.ca/*", // Bug 1859617 + ], + js: [ + { + file: "injections/js/bug1859617-installtrigger-removal-shim.js", + }, + ], + allFrames: true, + }, + }, { id: "bug1784141", platform: "android", @@ -639,20 +634,6 @@ const AVAILABLE_INJECTIONS = [ ], }, }, - { - id: "bug1799994", - platform: "desktop", - domain: "www.vivobarefoot.com", - bug: "1799994", - contentScripts: { - matches: ["*://www.vivobarefoot.com/*"], - css: [ - { - file: "injections/css/bug1799994-www.vivobarefoot.com-product-filters-fix.css", - }, - ], - }, - }, { id: "bug1800000", platform: "desktop", @@ -801,20 +782,6 @@ const AVAILABLE_INJECTIONS = [ ], }, }, - { - id: "bug1829952", - platform: "android", - domain: "eventer.co.il", - bug: "1829952", - contentScripts: { - matches: ["*://*.eventer.co.il/*"], - css: [ - { - file: "injections/css/bug1829952-eventer.co.il-button-height.css", - }, - ], - }, - }, { id: "bug1830747", platform: "android", diff --git a/browser/extensions/webcompat/data/ua_overrides.js b/browser/extensions/webcompat/data/ua_overrides.js index eae33a1f6678..1669b437e21a 100644 --- a/browser/extensions/webcompat/data/ua_overrides.js +++ b/browser/extensions/webcompat/data/ua_overrides.js @@ -861,22 +861,6 @@ const AVAILABLE_UA_OVERRIDES = [ }, }, }, - { - /* - * Bug 1827678 - UA override for static.slots.lv - * Webcompat issue #68379 - https://webcompat.com/issues/68379 - */ - id: "bug1827678-webc68379", - platform: "android", - domain: "static.slots.lv", - bug: "1827678", - config: { - matches: ["*://static.slots.lv/*"], - uaTransformer: originalUA => { - return UAHelpers.getDeviceAppropriateChromeUA(); - }, - }, - }, { /* * Bug 1827678 - UA override for mobile.onvue.com @@ -1262,23 +1246,6 @@ const AVAILABLE_UA_OVERRIDES = [ }, }, }, - { - /* - * Bug 1836181 - UA override for conference.amwell.com - * - * The site's content is not loaded unless a Chrome UA is used. - */ - id: "bug1836181", - platform: "all", - domain: "conference.amwell.com", - bug: "1836181", - config: { - matches: ["*://conference.amwell.com/*"], - uaTransformer: originalUA => { - return UAHelpers.getDeviceAppropriateChromeUA(); - }, - }, - }, { /* * Bug 1836182 - UA override for www.flatsatshadowglen.com @@ -1410,6 +1377,26 @@ const AVAILABLE_UA_OVERRIDES = [ }, }, }, + { + /* + * Bug 1858664 - UA override to freeze rv segment to 109 + * + * Some sites have issues with a UA string with "rv:" segment + * higher than 109, freezing it to 109 fixes the issues. + */ + id: "bug1858664", + platform: "all", + domain: "Sites with known breakage with rv: segment higher than 109", + bug: "1858664", + config: { + matches: [ + "*://*.tesco.com/*", // #1858664 + ], + uaTransformer: originalUA => { + return UAHelpers.capRvTo109(originalUA); + }, + }, + }, ]; module.exports = AVAILABLE_UA_OVERRIDES; diff --git a/browser/extensions/webcompat/injections/css/bug1605611-maps.google.com-directions-time.css b/browser/extensions/webcompat/injections/css/bug1605611-maps.google.com-directions-time.css deleted file mode 100644 index 75ca4a872326..000000000000 --- a/browser/extensions/webcompat/injections/css/bug1605611-maps.google.com-directions-time.css +++ /dev/null @@ -1,16 +0,0 @@ -/* 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/. */ - -/** - * Bug 1605611 - Cannot change Departure/arrival dates in Google Maps on Android - * - * Google Maps hides a datetime-local in its directions picker by giving it - * z-index:-50000, which causes it to be unclickable in Firefox. Here we - * use opacity:0 instead to hide it, while letting it remain clickable. - */ - -.ml-route-options-picker-container input[type="datetime-local"] { - z-index: unset; - opacity: 0; -} diff --git a/browser/extensions/webcompat/injections/css/bug1799994-www.vivobarefoot.com-product-filters-fix.css b/browser/extensions/webcompat/injections/css/bug1799994-www.vivobarefoot.com-product-filters-fix.css deleted file mode 100644 index fd42fd76488a..000000000000 --- a/browser/extensions/webcompat/injections/css/bug1799994-www.vivobarefoot.com-product-filters-fix.css +++ /dev/null @@ -1,17 +0,0 @@ -/* 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/. */ - -/** - * www.vivobarefoot.com - product filters cannot be interacted-with - * Bug #1799994 - https://bugzilla.mozilla.org/show_bug.cgi?id=1799994 - * WebCompat issue #108752 - https://webcompat.com/issues/108752 - * - * The breakage is actually correct behavior, but because of Chrome - * bug https://bugs.chromium.org/p/chromium/issues/detail?id=606208 - * it is currently not breaking on Chrome. We can work around it by - * bumping the z-index of the filter options. - */ -.page-products .filter-options { - z-index: 2; -} diff --git a/browser/extensions/webcompat/injections/css/bug1829952-eventer.co.il-button-height.css b/browser/extensions/webcompat/injections/css/bug1829952-eventer.co.il-button-height.css deleted file mode 100644 index 54de51589a85..000000000000 --- a/browser/extensions/webcompat/injections/css/bug1829952-eventer.co.il-button-height.css +++ /dev/null @@ -1,18 +0,0 @@ -/* 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/. */ - -/** - * eventer.co.il - a button is covering entire page - * Bug #1829952 - https://bugzilla.mozilla.org/show_bug.cgi?id=1829952 - * WebCompat issue #121296 - https://github.com/webcompat/web-bugs/issues/121296 - * - * The button is covering the page only in Firefox on mobile - * because of additional styles applied via @-moz-document url-prefix. - * Resetting the height makes the button normal size - */ - -#purchasePageRedesignContainer .mobileStripButton { - height: auto; - min-height: auto; -} diff --git a/browser/extensions/webcompat/injections/js/bug1605611-maps.google.com-directions-time.js b/browser/extensions/webcompat/injections/js/bug1605611-maps.google.com-directions-time.js deleted file mode 100644 index dae0c3514440..000000000000 --- a/browser/extensions/webcompat/injections/js/bug1605611-maps.google.com-directions-time.js +++ /dev/null @@ -1,38 +0,0 @@ -/* 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 1605611 - Cannot change Departure/arrival dates in Google Maps on Android - * - * This patch re-enables the disabled "Leave now" button. - * - * See https://bugzilla.mozilla.org/show_bug.cgi?id=1800498 and - * https://bugzilla.mozilla.org/show_bug.cgi?id=1605611 for details. - */ - -const selector = - ".ml-directions-searchbox-parent [aria-haspopup=dialog][disabled]"; - -document.addEventListener("DOMContentLoaded", () => { - // In case the element appeared before the MutationObserver was activated. - for (const elem of document.querySelectorAll(selector)) { - elem.disabled = false; - } - // Start watching for the insertion of the "Leave now" button. - const moOptions = { - attributeFilter: ["disabled"], - attributes: true, - subtree: true, - }; - const mo = new MutationObserver(function (records) { - for (const { target } of records) { - if (target.matches(selector)) { - target.disabled = false; - } - } - }); - mo.observe(document.body, moOptions); -}); diff --git a/browser/extensions/webcompat/injections/js/bug1859617-installtrigger-removal-shim.js b/browser/extensions/webcompat/injections/js/bug1859617-installtrigger-removal-shim.js new file mode 100644 index 000000000000..e91ef6442212 --- /dev/null +++ b/browser/extensions/webcompat/injections/js/bug1859617-installtrigger-removal-shim.js @@ -0,0 +1,26 @@ +/* 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 1859617 - Generic window.InstallTrigger removal shim + * + * This interventions shims window.InstallTrigger to undefine it. + */ + +/* globals exportFunction */ + +if (typeof window.InstallTrigger !== "undefined") { + console.info( + "window.InstallTrigger has been undefined for compatibility reasons. See https://bugzilla.mozilla.org/show_bug.cgi?id=1859617 for details." + ); + + Object.defineProperty(window.wrappedJSObject, "InstallTrigger", { + get: exportFunction(function () { + return undefined; + }, window), + set: exportFunction(function (_) {}, window), + }); +} diff --git a/browser/extensions/webcompat/lib/ua_helpers.js b/browser/extensions/webcompat/lib/ua_helpers.js index bbed941fc885..22e0d9fcb325 100644 --- a/browser/extensions/webcompat/lib/ua_helpers.js +++ b/browser/extensions/webcompat/lib/ua_helpers.js @@ -72,6 +72,13 @@ var UAHelpers = { .replace(`Firefox/${ver[1]}`, "Firefox/99.0") .replace(`rv:${ver[1]}`, "rv:99.0"); }, + capRvTo109(originalUA) { + const ver = originalUA.match(/rv:(\d+\.\d+)/); + if (!ver || parseFloat(ver[1]) <= 109) { + return originalUA; + } + return originalUA.replace(`rv:${ver[1]}`, "rv:109.0"); + }, getWindowsUA(originalUA) { const rv = originalUA.match("rv:[0-9]+.[0-9]+")[0]; const ver = originalUA.match("Firefox/[0-9]+.[0-9]+")[0]; diff --git a/browser/extensions/webcompat/manifest.json b/browser/extensions/webcompat/manifest.json index 79f67843360b..75a3c45a27f6 100644 --- a/browser/extensions/webcompat/manifest.json +++ b/browser/extensions/webcompat/manifest.json @@ -2,7 +2,7 @@ "manifest_version": 2, "name": "Web Compatibility Interventions", "description": "Urgent post-release fixes for web compatibility.", - "version": "119.1.0", + "version": "120.0.0", "browser_specific_settings": { "gecko": { "id": "webcompat@mozilla.org", diff --git a/browser/extensions/webcompat/moz.build b/browser/extensions/webcompat/moz.build index 2d2fdce3c342..034ed11ebc9e 100644 --- a/browser/extensions/webcompat/moz.build +++ b/browser/extensions/webcompat/moz.build @@ -46,7 +46,6 @@ FINAL_TARGET_FILES.features["webcompat@mozilla.org"]["injections"]["css"] += [ "injections/css/bug0000000-testbed-css-injection.css", "injections/css/bug1570328-developer-apple.com-transform-scale.css", "injections/css/bug1575000-apply.lloydsbank.co.uk-radio-buttons-fix.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/bug1651917-teletrader.com.body-transform-origin.css", @@ -62,11 +61,9 @@ FINAL_TARGET_FILES.features["webcompat@mozilla.org"]["injections"]["css"] += [ "injections/css/bug1774490-rainews.it-gallery-fix.css", "injections/css/bug1784141-aveeno.com-acuvue.com-unsupported.css", "injections/css/bug1784199-entrata-platform-unsupported.css", - "injections/css/bug1799994-www.vivobarefoot.com-product-filters-fix.css", "injections/css/bug1800000-www.honda.co.uk-choose-dealer-button-fix.css", "injections/css/bug1819678-nppes.cms.hhs.gov-unsupported-banner.css", "injections/css/bug1829949-tomshardware.com-scrollbar-width.css", - "injections/css/bug1829952-eventer.co.il-button-height.css", "injections/css/bug1830747-babbel.com-page-height.css", "injections/css/bug1830752-afisha.ru-slider-pointer-events.css", "injections/css/bug1830761-91mobiles.com-content-height.css", @@ -91,7 +88,6 @@ FINAL_TARGET_FILES.features["webcompat@mozilla.org"]["injections"]["js"] += [ "injections/js/bug1457335-histography.io-ua-change.js", "injections/js/bug1472075-bankofamerica.com-ua-change.js", "injections/js/bug1579159-m.tailieu.vn-pdfjs-worker-disable.js", - "injections/js/bug1605611-maps.google.com-directions-time.js", "injections/js/bug1631811-datastudio.google.com-indexedDB.js", "injections/js/bug1722955-frontgate.com-ua-override.js", "injections/js/bug1724868-news.yahoo.co.jp-ua-override.js", @@ -113,6 +109,7 @@ FINAL_TARGET_FILES.features["webcompat@mozilla.org"]["injections"]["js"] += [ "injections/js/bug1849058-nicochannel.jp-picture-in-picture-shim.js", "injections/js/bug1855014-eksiseyler.com.js", "injections/js/bug1855071-www.meteoam.it.js", + "injections/js/bug1859617-installtrigger-removal-shim.js", ] FINAL_TARGET_FILES.features["webcompat@mozilla.org"]["shims"] += [ diff --git a/testing/webcompat/interventions/tests/test_1605611_maps_google_com.py b/testing/webcompat/interventions/tests/test_1605611_maps_google_com.py deleted file mode 100644 index a4be5f1a1d1c..000000000000 --- a/testing/webcompat/interventions/tests/test_1605611_maps_google_com.py +++ /dev/null @@ -1,33 +0,0 @@ -import pytest -from webdriver.error import NoSuchElementException - -# Google puts [disabled="true"] on buttons, which causes them to not -# work in Firefox. Our intervention removes that [disabled] property. - -URL = "https://www.google.com/maps/dir/Fettstra%C3%9Fe+20,+D-20357+Hamburg,+Deutschland/Hauptkirche+St.+Michaelis,+Englische+Planke,+Hamburg/@53.5586949,9.9852882,14z/data=!4m8!4m7!1m2!1m1!1s0x47b18f4493d02fe1:0x6280c2a6cea3ed83!1m2!1m1!1s0x47b18f11e1dd5b45:0x187d5dca009a4b19!3e3?gl=de" -BUTTON_CSS = "button[jsaction^='directionsSearchbox.time']" -PICKER_CSS = ".ml-route-options-picker-container.visible" - - -def open_picker(client): - button = client.await_css(BUTTON_CSS, is_displayed=True) - assert button - client.mouse.click(element=button).perform() - return client.await_css(PICKER_CSS, is_displayed=True, timeout=5) - - -@pytest.mark.only_platforms("android") -@pytest.mark.asyncio -@pytest.mark.with_interventions -async def test_enabled(client): - await client.navigate(URL) - assert open_picker(client) - - -@pytest.mark.only_platforms("android") -@pytest.mark.asyncio -@pytest.mark.without_interventions -async def test_disabled(client): - await client.navigate(URL) - with pytest.raises(NoSuchElementException): - open_picker(client) diff --git a/testing/webcompat/interventions/tests/test_1799994_vivobarefoot_com.py b/testing/webcompat/interventions/tests/test_1799994_vivobarefoot_com.py deleted file mode 100644 index d1abe950b03d..000000000000 --- a/testing/webcompat/interventions/tests/test_1799994_vivobarefoot_com.py +++ /dev/null @@ -1,63 +0,0 @@ -import pytest -from webdriver.error import NoSuchElementException - -URL = "https://www.vivobarefoot.com/eu/mens" -FILTER_CSS = "#narrow-by-list .filter-wrapper:last-of-type dt" -SUBMENU_CSS = "#narrow-by-list .filter-wrapper:last-of-type dd" -POPUP1_CSS = "#globalePopupWrapper" -POPUP2_CSS = "#globale_overlay" -POPUP3_CSS = ".weblayer--box-subscription-1" - - -async def check_filter_opens(client): - await client.navigate(URL) - - popup = client.await_css(POPUP1_CSS, timeout=3) - if popup: - client.remove_element(popup) - popup = client.find_css(POPUP2_CSS) - if popup: - client.remove_element(popup) - popup = client.find_css(POPUP3_CSS) - if popup: - client.remove_element(popup) - - filter = client.await_css(FILTER_CSS) - - # we need to wait for the page to add the click listener - client.execute_async_script( - """ - const filter = arguments[0]; - const resolve = arguments[1]; - const ETP = EventTarget.prototype; - const AEL = ETP.addEventListener; - ETP.addEventListener = function(type) { - if (this === filter && type === "click") { - resolve(); - } - return AEL.apply(this, arguments); - }; - """, - filter, - ) - - client.mouse.click(element=filter).perform() - try: - client.await_css(SUBMENU_CSS, is_displayed=True, timeout=3) - except NoSuchElementException: - return False - return True - - -@pytest.mark.skip_platforms("android") -@pytest.mark.asyncio -@pytest.mark.with_interventions -async def test_enabled(client): - assert await check_filter_opens(client) - - -@pytest.mark.skip_platforms("android") -@pytest.mark.asyncio -@pytest.mark.without_interventions -async def test_disabled(client): - assert not await check_filter_opens(client) diff --git a/testing/webcompat/interventions/tests/test_1829952_eventer_co_il.py b/testing/webcompat/interventions/tests/test_1829952_eventer_co_il.py deleted file mode 100644 index 3109d1dbc763..000000000000 --- a/testing/webcompat/interventions/tests/test_1829952_eventer_co_il.py +++ /dev/null @@ -1,32 +0,0 @@ -import pytest - -URL = "https://www.eventer.co.il" -EVENT_CSS = "a.slide-a-tag[href*='/event']" -ELEM_CSS = ".mobileStripButton:not(.ng-hide)" - - -async def is_too_tall(client): - await client.navigate(URL) - event = client.await_css(EVENT_CSS) - await client.navigate(URL + client.get_element_attribute(event, "href")) - elem = client.await_css(ELEM_CSS) - return client.execute_script( - """ - return window.innerHeight == arguments[0].getBoundingClientRect().height; - """, - elem, - ) - - -@pytest.mark.only_platforms("android") -@pytest.mark.asyncio -@pytest.mark.with_interventions -async def test_enabled(client): - assert not await is_too_tall(client) - - -@pytest.mark.only_platforms("android") -@pytest.mark.asyncio -@pytest.mark.without_interventions -async def test_disabled(client): - assert await is_too_tall(client) diff --git a/testing/webcompat/interventions/tests/test_1836181_conference_amwell_com.py b/testing/webcompat/interventions/tests/test_1836181_conference_amwell_com.py deleted file mode 100644 index de1a03925c10..000000000000 --- a/testing/webcompat/interventions/tests/test_1836181_conference_amwell_com.py +++ /dev/null @@ -1,24 +0,0 @@ -import pytest - -URL = "https://conference.amwell.com/" -UNSUPPORTED_DESKTOP_CSS = "a.container-recommended-browser" -UNSUPPORTED_MOBILE_CSS = "[onclick='joinWithApp()']" -LOGIN_CSS = "login-layout" - - -@pytest.mark.asyncio -@pytest.mark.with_interventions -async def test_enabled(client): - await client.navigate(URL) - assert client.await_css(LOGIN_CSS, is_displayed=True) - - -@pytest.mark.asyncio -@pytest.mark.without_interventions -async def test_disabled(client): - await client.navigate(URL) - desktop, mobile = client.await_first_element_of( - [client.css(UNSUPPORTED_DESKTOP_CSS), client.css(UNSUPPORTED_MOBILE_CSS)], - is_displayed=True, - ) - assert desktop or mobile