From 88ec901b2ce3e2a05bbfbcdb26c706e23ee8bfb5 Mon Sep 17 00:00:00 2001 From: Thomas Wisniewski Date: Fri, 18 Oct 2024 16:31:00 +0000 Subject: [PATCH] Bug 1925270 - uplift webcompat interventions for v133.2.0 to ESR 128; r=denschub a=RyanVM Differential Revision: https://phabricator.services.mozilla.com/D226038 --- .../extensions/webcompat/data/injections.js | 262 ++++++++++++++++-- browser/extensions/webcompat/data/shims.js | 21 ++ .../extensions/webcompat/data/ua_overrides.js | 248 +++++++++++++++++ ...g1779908-play.google.com-scrollbar-fix.css | 15 + ....google.com-font-submenus-inaccessible.css | 18 ++ ...n.yahoo.com-unhide-password-button-fix.css | 15 + ...877346-offerup.com-infinite-scroll-fix.css | 20 -- ...opers.pinterest.com-list-alignment-fix.css | 12 + .../bug1882040-disable-pull-to-refresh.css | 14 - ...ug1886616-www.six-group.com-select-fix.css | 15 + ...895051-www.zhihu.com-broken-button-fix.css | 16 ++ ...g1895994-softtrans.ro-unlock-scrolling.css | 16 ++ ...g1896349-vivaldi.com-selected-text-fix.css | 13 + ...g1896571-gracobaby.ca-unlock-scrolling.css | 18 ++ ...1730-www.korg.com-fix-broken-page-loads.js | 35 +++ ...g1881922-disable-legacy-mutation-events.js | 43 +++ ...ffice365-email-handling-prompt-autohide.js | 36 +++ .../js/bug1898952-digits.t-mobile.com.js | 68 +++++ ...-plus.nhk.jp-request-picture-in-picture.js | 27 ++ ...24500-www.tiktok.com-fix-captcha-slider.js | 71 +++++ .../extensions/webcompat/lib/ua_overrides.js | 7 +- browser/extensions/webcompat/manifest.json | 3 +- browser/extensions/webcompat/moz.build | 18 +- .../extensions/webcompat/shims/figshare.js | 82 ++++++ .../extensions/webcompat/data/injections.js | 262 ++++++++++++++++-- .../assets/extensions/webcompat/data/shims.js | 21 ++ .../extensions/webcompat/data/ua_overrides.js | 248 +++++++++++++++++ ...g1779908-play.google.com-scrollbar-fix.css | 15 + ....google.com-font-submenus-inaccessible.css | 18 ++ ...n.yahoo.com-unhide-password-button-fix.css | 15 + ...877346-offerup.com-infinite-scroll-fix.css | 20 -- ...opers.pinterest.com-list-alignment-fix.css | 12 + .../bug1882040-disable-pull-to-refresh.css | 14 - ...ug1886616-www.six-group.com-select-fix.css | 15 + ...895051-www.zhihu.com-broken-button-fix.css | 16 ++ ...g1895994-softtrans.ro-unlock-scrolling.css | 16 ++ ...g1896349-vivaldi.com-selected-text-fix.css | 13 + ...g1896571-gracobaby.ca-unlock-scrolling.css | 18 ++ ...1730-www.korg.com-fix-broken-page-loads.js | 35 +++ ...g1881922-disable-legacy-mutation-events.js | 43 +++ ...ffice365-email-handling-prompt-autohide.js | 36 +++ .../js/bug1898952-digits.t-mobile.com.js | 68 +++++ ...-plus.nhk.jp-request-picture-in-picture.js | 27 ++ ...24500-www.tiktok.com-fix-captcha-slider.js | 71 +++++ .../extensions/webcompat/lib/ua_overrides.js | 7 +- .../assets/extensions/webcompat/manifest.json | 3 +- .../extensions/webcompat/shims/figshare.js | 82 ++++++ testing/webcompat/client.py | 18 +- .../tests/test_1779908_play_google_com.py | 31 +++ .../tests/test_1836872_docs_google_com.py | 67 +++++ .../tests/test_1856915_login_yahoo_com.py | 44 +++ .../tests/test_1886616_www_six-group_com.py | 41 +++ .../tests/test_1896349_vivaldi_com.py | 40 +++ .../tests/test_1898952_digits_t-mobile_com.py | 23 ++ .../tests/test_1899937_plus_nhk_jp.py | 36 +++ testing/webcompat/requirements.txt | 1 + 56 files changed, 2348 insertions(+), 121 deletions(-) create mode 100644 browser/extensions/webcompat/injections/css/bug1779908-play.google.com-scrollbar-fix.css create mode 100644 browser/extensions/webcompat/injections/css/bug1836872-docs.google.com-font-submenus-inaccessible.css create mode 100644 browser/extensions/webcompat/injections/css/bug1856915-login.yahoo.com-unhide-password-button-fix.css delete mode 100644 browser/extensions/webcompat/injections/css/bug1877346-offerup.com-infinite-scroll-fix.css create mode 100644 browser/extensions/webcompat/injections/css/bug1879879-developers.pinterest.com-list-alignment-fix.css delete mode 100644 browser/extensions/webcompat/injections/css/bug1882040-disable-pull-to-refresh.css create mode 100644 browser/extensions/webcompat/injections/css/bug1886616-www.six-group.com-select-fix.css create mode 100644 browser/extensions/webcompat/injections/css/bug1895051-www.zhihu.com-broken-button-fix.css create mode 100644 browser/extensions/webcompat/injections/css/bug1895994-softtrans.ro-unlock-scrolling.css create mode 100644 browser/extensions/webcompat/injections/css/bug1896349-vivaldi.com-selected-text-fix.css create mode 100644 browser/extensions/webcompat/injections/css/bug1896571-gracobaby.ca-unlock-scrolling.css create mode 100644 browser/extensions/webcompat/injections/js/bug1841730-www.korg.com-fix-broken-page-loads.js create mode 100644 browser/extensions/webcompat/injections/js/bug1881922-disable-legacy-mutation-events.js create mode 100644 browser/extensions/webcompat/injections/js/bug1889326-office365-email-handling-prompt-autohide.js create mode 100644 browser/extensions/webcompat/injections/js/bug1898952-digits.t-mobile.com.js create mode 100644 browser/extensions/webcompat/injections/js/bug1899937-plus.nhk.jp-request-picture-in-picture.js create mode 100644 browser/extensions/webcompat/injections/js/bug1924500-www.tiktok.com-fix-captcha-slider.js create mode 100644 browser/extensions/webcompat/shims/figshare.js create mode 100644 mobile/android/android-components/components/feature/webcompat/src/main/assets/extensions/webcompat/injections/css/bug1779908-play.google.com-scrollbar-fix.css create mode 100644 mobile/android/android-components/components/feature/webcompat/src/main/assets/extensions/webcompat/injections/css/bug1836872-docs.google.com-font-submenus-inaccessible.css create mode 100644 mobile/android/android-components/components/feature/webcompat/src/main/assets/extensions/webcompat/injections/css/bug1856915-login.yahoo.com-unhide-password-button-fix.css delete mode 100644 mobile/android/android-components/components/feature/webcompat/src/main/assets/extensions/webcompat/injections/css/bug1877346-offerup.com-infinite-scroll-fix.css create mode 100644 mobile/android/android-components/components/feature/webcompat/src/main/assets/extensions/webcompat/injections/css/bug1879879-developers.pinterest.com-list-alignment-fix.css delete mode 100644 mobile/android/android-components/components/feature/webcompat/src/main/assets/extensions/webcompat/injections/css/bug1882040-disable-pull-to-refresh.css create mode 100644 mobile/android/android-components/components/feature/webcompat/src/main/assets/extensions/webcompat/injections/css/bug1886616-www.six-group.com-select-fix.css create mode 100644 mobile/android/android-components/components/feature/webcompat/src/main/assets/extensions/webcompat/injections/css/bug1895051-www.zhihu.com-broken-button-fix.css create mode 100644 mobile/android/android-components/components/feature/webcompat/src/main/assets/extensions/webcompat/injections/css/bug1895994-softtrans.ro-unlock-scrolling.css create mode 100644 mobile/android/android-components/components/feature/webcompat/src/main/assets/extensions/webcompat/injections/css/bug1896349-vivaldi.com-selected-text-fix.css create mode 100644 mobile/android/android-components/components/feature/webcompat/src/main/assets/extensions/webcompat/injections/css/bug1896571-gracobaby.ca-unlock-scrolling.css create mode 100644 mobile/android/android-components/components/feature/webcompat/src/main/assets/extensions/webcompat/injections/js/bug1841730-www.korg.com-fix-broken-page-loads.js create mode 100644 mobile/android/android-components/components/feature/webcompat/src/main/assets/extensions/webcompat/injections/js/bug1881922-disable-legacy-mutation-events.js create mode 100644 mobile/android/android-components/components/feature/webcompat/src/main/assets/extensions/webcompat/injections/js/bug1889326-office365-email-handling-prompt-autohide.js create mode 100644 mobile/android/android-components/components/feature/webcompat/src/main/assets/extensions/webcompat/injections/js/bug1898952-digits.t-mobile.com.js create mode 100644 mobile/android/android-components/components/feature/webcompat/src/main/assets/extensions/webcompat/injections/js/bug1899937-plus.nhk.jp-request-picture-in-picture.js create mode 100644 mobile/android/android-components/components/feature/webcompat/src/main/assets/extensions/webcompat/injections/js/bug1924500-www.tiktok.com-fix-captcha-slider.js create mode 100644 mobile/android/android-components/components/feature/webcompat/src/main/assets/extensions/webcompat/shims/figshare.js create mode 100644 testing/webcompat/interventions/tests/test_1779908_play_google_com.py create mode 100644 testing/webcompat/interventions/tests/test_1836872_docs_google_com.py create mode 100644 testing/webcompat/interventions/tests/test_1856915_login_yahoo_com.py create mode 100644 testing/webcompat/interventions/tests/test_1886616_www_six-group_com.py create mode 100644 testing/webcompat/interventions/tests/test_1896349_vivaldi_com.py create mode 100644 testing/webcompat/interventions/tests/test_1898952_digits_t-mobile_com.py create mode 100644 testing/webcompat/interventions/tests/test_1899937_plus_nhk_jp.py diff --git a/browser/extensions/webcompat/data/injections.js b/browser/extensions/webcompat/data/injections.js index 215c0c399c3c..b8d89ae9d65a 100644 --- a/browser/extensions/webcompat/data/injections.js +++ b/browser/extensions/webcompat/data/injections.js @@ -290,6 +290,8 @@ const AVAILABLE_INJECTIONS = [ "*://www.facebook.com/*", // Bug 1739489 "*://twitter.com/*", // Bug 1776229 "*://mobile.twitter.com/*", // Bug 1776229 + "*://x.com/*", // Bug 1776229 + "*://mobile.x.com/*", // Bug 1776229 "*://*.reddit.com/*", // Bug 1829755 ], js: [ @@ -585,6 +587,7 @@ const AVAILABLE_INJECTIONS = [ "*://*.lafoodbank.org/*", // 127006 "*://rutamayacoffee.com/*", // 129353 "*://ottoandspike.com.au/*", // bugzilla 1644602 + "*://give.umrelief.org/give/*", // bugzilla 1916407 ], js: [ { @@ -1001,20 +1004,6 @@ const AVAILABLE_INJECTIONS = [ ], }, }, - { - id: "bug1877346", - platform: "android", - domain: "offerup.com", - bug: "1877346", - contentScripts: { - matches: ["*://offerup.com/*"], - css: [ - { - file: "injections/css/bug1877346-offerup.com-infinite-scroll-fix.css", - }, - ], - }, - }, { id: "bug1884842", platform: "android", @@ -1059,15 +1048,108 @@ const AVAILABLE_INJECTIONS = [ }, }, { - id: "1882040", - platform: "android", - domain: "YouTube Shorts", - bug: "1882040", + id: "1922175", + platform: "all", + domain: "app.livingsecurity.com", + bug: "1922175", contentScripts: { - matches: ["*://m.youtube.com/shorts", "*://m.youtube.com/shorts/*"], + matches: ["*://app.livingsecurity.com/*"], + js: [ + { + file: "injections/js/bug1896383-error-capturestacktrace-shim.js", + }, + ], + }, + }, + { + id: "bug1889326", + platform: "desktop", + domain: "Office 365 email handling prompt", + bug: "1889326", + contentScripts: { + matches: [ + "*://*.live.com/*", + "*://*.office.com/*", + "*://*.office365.com/*", + "*://*.office365.us/*", + "*://*.outlook.cn/*", + "*://*.outlook.com/*", + "*://*.sharepoint.com/*", + ], + js: [ + { + file: "injections/js/bug1889326-office365-email-handling-prompt-autohide.js", + }, + ], + allFrames: true, + }, + }, + { + id: "bug1881922", + platform: "all", + domain: "helpdeskgeek.com", + bug: "1881922", + contentScripts: { + matches: ["*://helpdeskgeek.com/*"], + js: [ + { + file: "injections/js/bug1881922-disable-legacy-mutation-events.js", + }, + ], + }, + }, + { + id: "bug1901780", + platform: "all", + domain: "vanbreda-health.be", + bug: "1901780", + contentScripts: { + matches: ["*://www.vanbreda-health.be/*"], + js: [ + { + file: "injections/js/bug1881922-disable-legacy-mutation-events.js", + }, + ], + }, + }, + { + id: "bug1896571", + platform: "all", + domain: "gracobaby.ca", + bug: "1896571", + contentScripts: { + matches: ["*://www.gracobaby.ca/*"], css: [ { - file: "injections/css/bug1882040-disable-pull-to-refresh.css", + file: "injections/css/bug1896571-gracobaby.ca-unlock-scrolling.css", + }, + ], + }, + }, + { + id: "bug1895994", + platform: "android", + domain: "www.softrans.ro", + bug: "1895994", + contentScripts: { + matches: ["*://*.softrans.ro/*"], + css: [ + { + file: "injections/css/bug1895994-softtrans.ro-unlock-scrolling.css", + }, + ], + }, + }, + { + id: "bug1898952", + platform: "desktop", + domain: "digits.t-mobile.com", + bug: "1898952", + contentScripts: { + matches: ["*://digits.t-mobile.com/*"], + js: [ + { + file: "injections/js/bug1898952-digits.t-mobile.com.js", }, ], }, @@ -1094,6 +1176,146 @@ const AVAILABLE_INJECTIONS = [ allFrames: true, }, }, + { + id: "bug1899937", + platform: "all", + domain: "plus.nhk.jp", + bug: "1899937", + contentScripts: { + matches: ["*://plus.nhk.jp/*"], + js: [ + { + file: "injections/js/bug1899937-plus.nhk.jp-request-picture-in-picture.js", + }, + ], + }, + }, + { + id: "bug1886616", + platform: "all", + domain: "www.six-group.com", + bug: "1886616", + contentScripts: { + matches: ["*://www.six-group.com/*/market-data/etf/etf-explorer.html*"], + css: [ + { + file: "injections/css/bug1886616-www.six-group.com-select-fix.css", + }, + ], + }, + }, + { + id: "bug1896349", + platform: "all", + domain: "vivaldi.com", + bug: "1896349", + contentScripts: { + matches: ["*://vivaldi.com/*"], + css: [ + { + file: "injections/css/bug1896349-vivaldi.com-selected-text-fix.css", + }, + ], + }, + }, + { + id: "bug1836872", + platform: "desktop", + domain: "docs.google.com", + bug: "1836872", + contentScripts: { + matches: ["*://docs.google.com/document/*"], + css: [ + { + file: "injections/css/bug1836872-docs.google.com-font-submenus-inaccessible.css", + }, + ], + }, + }, + { + id: "bug1779908", + platform: "desktop", + domain: "docs.google.com", + bug: "1779908", + contentScripts: { + matches: ["*://play.google.com/store/*"], + css: [ + { + file: "injections/css/bug1779908-play.google.com-scrollbar-fix.css", + }, + ], + }, + }, + { + id: "bug1879879", + platform: "all", + domain: "developers.pinterest.com", + bug: "1879879", + contentScripts: { + matches: ["*://developers.pinterest.com/docs/*"], + css: [ + { + file: "injections/css/bug1879879-developers.pinterest.com-list-alignment-fix.css", + }, + ], + }, + }, + { + id: "bug1856915", + platform: "android", + domain: "login.yahoo.com", + bug: "1856915", + contentScripts: { + matches: ["*://login.yahoo.com/account/*"], + css: [ + { + file: "injections/css/bug1856915-login.yahoo.com-unhide-password-button-fix.css", + }, + ], + }, + }, + { + id: "bug1841730", + platform: "desktop", + domain: "www.korg.com", + bug: "1841730", + contentScripts: { + matches: ["*://www.korg.com/*/support/download/product/*"], + js: [ + { + file: "injections/js/bug1841730-www.korg.com-fix-broken-page-loads.js", + }, + ], + }, + }, + { + id: "bug1895051", + platform: "all", + domain: "www.zhihu.com", + bug: "1895051", + contentScripts: { + matches: ["*://www.zhihu.com/question/*"], + css: [ + { + file: "injections/css/bug1895051-www.zhihu.com-broken-button-fix.css", + }, + ], + }, + }, + { + id: "bug1924500", + platform: "desktop", + domain: "www.tiktok.com", + bug: "1924500", + contentScripts: { + matches: ["*://www.tiktok.com/*"], + js: [ + { + file: "injections/js/bug1924500-www.tiktok.com-fix-captcha-slider.js", + }, + ], + }, + }, ]; module.exports = AVAILABLE_INJECTIONS; diff --git a/browser/extensions/webcompat/data/shims.js b/browser/extensions/webcompat/data/shims.js index ab7234c217df..ac6f86ad8499 100644 --- a/browser/extensions/webcompat/data/shims.js +++ b/browser/extensions/webcompat/data/shims.js @@ -379,6 +379,27 @@ const AVAILABLE_SHIMS = [ ], onlyIfBlockedByETP: true, }, + { + id: "figshare", + platform: "all", + name: "Figshare", + bug: "1895990", + contentScripts: [ + { + js: "figshare.js", + matches: [ + "*://*.figsharelabs.io/*", + "*://opal.latrobe.edu.au/*", + "*://repository.lboro.ac.uk/*", + "*://portal.sds.ox.ac.uk/*", + "*://curate.nd.edu/*", + "*://kilthub.cmu.edu/*", + ], + runAt: "document_start", + }, + ], + onlyIfDFPIActive: true, + }, { id: "GoogleAnalyticsAndTagManager", platform: "all", diff --git a/browser/extensions/webcompat/data/ua_overrides.js b/browser/extensions/webcompat/data/ua_overrides.js index 23d17fb1d91c..21d8d9271279 100644 --- a/browser/extensions/webcompat/data/ua_overrides.js +++ b/browser/extensions/webcompat/data/ua_overrides.js @@ -1210,6 +1210,254 @@ const AVAILABLE_UA_OVERRIDES = [ }, }, }, + { + /* + * Bug 1842767 - UA override for passport.bilibili.com + * + * Spoofing as Chrome makes the login page use a mobile layout. + */ + id: "bug1842767", + platform: "android", + domain: "passport.bilibili.com", + bug: "1842767", + config: { + matches: ["*://*.passport.bilibili.com/*"], + uaTransformer: () => { + return UAHelpers.getDeviceAppropriateChromeUA(); + }, + }, + }, + { + /* + * Bug 1896354 - UA override for my.rhinoshield.fr + * + * Sites only supports Chrome, but seems to work with a UA spoof. + */ + id: "bug1896354", + platform: "all", + domain: "my.rhinoshield.fr", + bug: "1896354", + config: { + matches: ["*://my.rhinoshield.fr/*"], + uaTransformer: () => { + return UAHelpers.getDeviceAppropriateChromeUA(); + }, + }, + }, + { + /* + * Bug 1813177 - UA override for rbi.org.in + * + * The site endlessly redirects for a Firefox mobile UA string. + */ + id: "bug1813177", + platform: "android", + domain: "m.rbi.org.in", + bug: "1813177", + config: { + matches: ["*://m.rbi.org.in/*"], + uaTransformer: () => { + return UAHelpers.getDeviceAppropriateChromeUA(); + }, + }, + }, + { + /* + * Bug 1903970 - UA override for unimedlitoral.com.br + * Webcompat issue #138342 - https://webcompat.com/issues/138342 + * + * Site blocks Firefox, but seems to work with a UA spoof. + */ + id: "bug1903970", + platform: "all", + domain: "www.unimedlitoral.com.br", + bug: "1903970", + config: { + matches: ["*://www.unimedlitoral.com.br/agendaonline/*"], + uaTransformer: () => { + return UAHelpers.getDeviceAppropriateChromeUA(); + }, + }, + }, + { + /* + * Bug 1902474 - UA override for lg.jio.com + * Webcompat issue #124681 - https://webcompat.com/issues/124681 + * + * Site incorrectly blocks Firefox on Android. A desktop UA works. + */ + id: "bug1902474", + platform: "android", + domain: "lg.jio.com", + bug: "1902474", + config: { + matches: ["*://lg.jio.com/*"], + uaTransformer: originalUA => { + return originalUA.replace(/ (Mobile|Tablet);/, ""); + }, + }, + }, + { + /* + * Bug 1909448 - UA override for fire.honeywell.com + * + * Site doesn't load on Firefox, but works fine with a UA spoof. + */ + id: "bug1909448", + platform: "all", + domain: "fire.honeywell.com", + bug: "1909448", + config: { + matches: ["*://fire.honeywell.com/*"], + uaTransformer: () => { + return UAHelpers.getDeviceAppropriateChromeUA(); + }, + }, + }, + { + /* + * Bug 1899937 - UA override for plus.nhk.jp + * Webcompat issue #103463 - https://webcompat.com/issues/103463 + * + * Site blocks Firefox, so a UA spoof and an intervention is needed. + */ + id: "bug1899937-ua", + platform: "all", + domain: "plus.nhk.jp", + bug: "1899937", + config: { + matches: ["*://plus.nhk.jp/*"], + uaTransformer: () => { + return UAHelpers.getDeviceAppropriateChromeUA(); + }, + }, + }, + { + /* + * Bug 1897724 - UA override for app.homewyse.com + * Webcompat issue #137164 - https://webcompat.com/issues/137164 + * + * Site blocks Firefox, but seems to work with a UA spoof. + */ + id: "bug1897724", + platform: "all", + domain: "app.homewyse.com", + bug: "1897724", + config: { + matches: ["*://app.homewyse.com/*"], + uaTransformer: () => { + return UAHelpers.getDeviceAppropriateChromeUA(); + }, + }, + }, + { + /* + * Bug 1898923 - UA override for trade-in.vodafone.com + * Webcompat issue #127158 - https://webcompat.com/issues/127158 + * + * Site blocks Firefox, but seems to work with a UA spoof. + */ + id: "bug1898923", + platform: "all", + domain: "trade-in.vodafone.com", + bug: "1898923", + config: { + matches: ["*://trade-in.vodafone.com/*"], + uaTransformer: () => { + return UAHelpers.getDeviceAppropriateChromeUA(); + }, + }, + }, + { + /* + * Bug 1899067 - UA override for game.granbluefantasy.jp + * Webcompat issue #43155 - https://webcompat.com/issues/43155 + * + * Site blocks Firefox, but seems to work with a UA spoof. + */ + id: "bug1899067", + platform: "desktop", + domain: "game.granbluefantasy.jp", + bug: "1899067", + config: { + matches: ["*://game.granbluefantasy.jp/*"], + uaTransformer: () => { + return UAHelpers.getDeviceAppropriateChromeUA(); + }, + }, + }, + { + /* + * Bug 1898941 - UA override for events.webinar.ru + * Webcompat issue #121871 - https://webcompat.com/issues/121871 + * + * Site blocks Firefox, but seems to work with a UA spoof. + */ + id: "bug1898941", + platform: "all", + domain: "events.webinar.ru", + bug: "1898941", + config: { + matches: ["*://events.webinar.ru/*"], + uaTransformer: () => { + return UAHelpers.getDeviceAppropriateChromeUA(); + }, + }, + }, + { + /* + * Bug 1919004 - UA override for www.editoracontexto.com.br + * Webcompat issue #141641 - https://webcompat.com/issues/141641 + * + * Site presents its desktop CSS to Firefox on Android. + */ + id: "bug1919004", + platform: "android", + domain: "www.editoracontexto.com.br", + bug: "1919004", + config: { + matches: ["*://www.editoracontexto.com.br/*"], + uaTransformer: () => { + return UAHelpers.getDeviceAppropriateChromeUA(); + }, + }, + }, + { + /* + * Bug 1921410 - UA override for beta.maps.apple.com + * Webcompat issue #140205 - https://webcompat.com/issues/140205 + * + * Apple Maps beta artifically blocks Linux. + */ + id: "bug1921410", + platform: "linux", + domain: "beta.maps.apple.com", + bug: "1921410", + config: { + matches: ["*://beta.maps.apple.com/*"], + uaTransformer: originalUA => { + return UAHelpers.getWindowsUA(originalUA); + }, + }, + }, + { + /* + * Bug 1899948 - UA override for tv.partner.co.il + * Webcompat issue #64703 - https://webcompat.com/issues/64703 + * + * Site blocks Firefox, but seems to work with a UA spoof. + */ + id: "1899948", + platform: "all", + domain: "tv.partner.co.il", + bug: "1899948", + config: { + matches: ["*://tv.partner.co.il/*"], + uaTransformer: () => { + return UAHelpers.getDeviceAppropriateChromeUA(); + }, + }, + }, ]; module.exports = AVAILABLE_UA_OVERRIDES; diff --git a/browser/extensions/webcompat/injections/css/bug1779908-play.google.com-scrollbar-fix.css b/browser/extensions/webcompat/injections/css/bug1779908-play.google.com-scrollbar-fix.css new file mode 100644 index 000000000000..efed93cc9b09 --- /dev/null +++ b/browser/extensions/webcompat/injections/css/bug1779908-play.google.com-scrollbar-fix.css @@ -0,0 +1,15 @@ +/* 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/. */ + +/** + * play.google.com - Extra scrollbar not hidden on store pages. + * + * Bug #1779908 - https://bugzilla.mozilla.org/show_bug.cgi?id=1779908 + * + * They are hiding the scrollbar with ::webkit-scrollbar, but not the standards- + * compliant method `scrollbar-width:none`. + */ +.aoJE7e { + scrollbar-width: none; +} diff --git a/browser/extensions/webcompat/injections/css/bug1836872-docs.google.com-font-submenus-inaccessible.css b/browser/extensions/webcompat/injections/css/bug1836872-docs.google.com-font-submenus-inaccessible.css new file mode 100644 index 000000000000..fa332c3eafa0 --- /dev/null +++ b/browser/extensions/webcompat/injections/css/bug1836872-docs.google.com-font-submenus-inaccessible.css @@ -0,0 +1,18 @@ +/* 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/. */ + +/** + * docs.google.com - font submenus are inaccessible with overlay scrollbars on + * Bug #1836872 - https://bugzilla.mozilla.org/show_bug.cgi?id=1836872 + * + * The submenu panels are shifted too far to the right when overlay + * scrollbars are visible, and so they are dismissed while attemting + * to mouse over to them. Shifting them to the left fixes them. + */ +/* font family sub-menus */ +[class="goog-menu goog-menu-vertical"], +/* font style sub-menus */ +.goog-menu.apps-menu-hide-mnemonics { + margin-inline-start: -20px; +} diff --git a/browser/extensions/webcompat/injections/css/bug1856915-login.yahoo.com-unhide-password-button-fix.css b/browser/extensions/webcompat/injections/css/bug1856915-login.yahoo.com-unhide-password-button-fix.css new file mode 100644 index 000000000000..aebe2a3b84fb --- /dev/null +++ b/browser/extensions/webcompat/injections/css/bug1856915-login.yahoo.com-unhide-password-button-fix.css @@ -0,0 +1,15 @@ +/* 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/. */ + +/** + * login.yahoo.com - Toggle to reveal password text is missing + * + * Bug #1856915 - https://bugzilla.mozilla.org/show_bug.cgi?id=1856915 + * + * Yahoo is using letter-spacing in a way which relies on a Blink quirk to + * not inadvertently hide their show/hide password text toggle. + */ +#password-container > input[type="password"] { + min-width: 0; +} diff --git a/browser/extensions/webcompat/injections/css/bug1877346-offerup.com-infinite-scroll-fix.css b/browser/extensions/webcompat/injections/css/bug1877346-offerup.com-infinite-scroll-fix.css deleted file mode 100644 index 24681686f4bf..000000000000 --- a/browser/extensions/webcompat/injections/css/bug1877346-offerup.com-infinite-scroll-fix.css +++ /dev/null @@ -1,20 +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/. */ - -/** - * offerup.com - Infinite scroll doesn't work - * Bug #1720060 - https://bugzilla.mozilla.org/show_bug.cgi?id=1720060 - * - * The site uses IntersectionObserver to show new items on the page, - * as the page being scrolled and it doesn't work with with - * Dynamic Toolbar enabled. Adding an empty element after the content - * to make up for the height of the dynamic toolbar makes it work. - */ - -#__next::after { - display: block; - width: 100%; - height: 10px; - content: ""; -} diff --git a/browser/extensions/webcompat/injections/css/bug1879879-developers.pinterest.com-list-alignment-fix.css b/browser/extensions/webcompat/injections/css/bug1879879-developers.pinterest.com-list-alignment-fix.css new file mode 100644 index 000000000000..b93ab382c493 --- /dev/null +++ b/browser/extensions/webcompat/injections/css/bug1879879-developers.pinterest.com-list-alignment-fix.css @@ -0,0 +1,12 @@ +/* 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/. */ + +/** + * developers.pinterest.com - List elements are misaligned + * + * Bug #1879879 - https://bugzilla.mozilla.org/show_bug.cgi?id=1879879 + */ +li > span:has(> div) { + display: block; +} diff --git a/browser/extensions/webcompat/injections/css/bug1882040-disable-pull-to-refresh.css b/browser/extensions/webcompat/injections/css/bug1882040-disable-pull-to-refresh.css deleted file mode 100644 index b075f962124c..000000000000 --- a/browser/extensions/webcompat/injections/css/bug1882040-disable-pull-to-refresh.css +++ /dev/null @@ -1,14 +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/. */ - -/** - * m.youtube.com/shorts - pull-to-refresh breaks scrolling - * Bug #1882040 - https://bugzilla.mozilla.org/show_bug.cgi?id=1882040 - * - * Pull-to-refresh is breaking scrolling on the YouTube Shorts mobile page. - * The easiest work-around is to inject this CSS to disable it for now. - */ -html { - overscroll-behavior: contain; -} diff --git a/browser/extensions/webcompat/injections/css/bug1886616-www.six-group.com-select-fix.css b/browser/extensions/webcompat/injections/css/bug1886616-www.six-group.com-select-fix.css new file mode 100644 index 000000000000..e6587d45861f --- /dev/null +++ b/browser/extensions/webcompat/injections/css/bug1886616-www.six-group.com-select-fix.css @@ -0,0 +1,15 @@ +/* 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.six-group.com - Selected input values are hidden + * Bug #1886616 - https://bugzilla.mozilla.org/show_bug.cgi?id=1886616 + * WebCompat issue #129271 - https://webcompat.com/issues/129271 + * + * The page is hiding CSS content, which is not interoperable. In this + * case, it causes their select dropdown's values to be hidden. + */ +select { + content: normal; +} diff --git a/browser/extensions/webcompat/injections/css/bug1895051-www.zhihu.com-broken-button-fix.css b/browser/extensions/webcompat/injections/css/bug1895051-www.zhihu.com-broken-button-fix.css new file mode 100644 index 000000000000..136d79520486 --- /dev/null +++ b/browser/extensions/webcompat/injections/css/bug1895051-www.zhihu.com-broken-button-fix.css @@ -0,0 +1,16 @@ +/* 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.zhihu.com - Certain directory buttons are unclickable + * + * Bug #1895051 - https://bugzilla.mozilla.org/show_bug.cgi?id=1895051 + * + * On narrow enough screens, some of the site's directory buttons + * overlap with text differently on Firefox and Safari than in Chromium, + * making them unclickable. This fixes the issue. + */ +.css-376mun { + display: block; +} diff --git a/browser/extensions/webcompat/injections/css/bug1895994-softtrans.ro-unlock-scrolling.css b/browser/extensions/webcompat/injections/css/bug1895994-softtrans.ro-unlock-scrolling.css new file mode 100644 index 000000000000..85d0dc12ac36 --- /dev/null +++ b/browser/extensions/webcompat/injections/css/bug1895994-softtrans.ro-unlock-scrolling.css @@ -0,0 +1,16 @@ +/* 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/. */ + +/** + * softtrans.ro - users cannot scroll the page horizontally on Android + * Bug #1895994 - https://bugzilla.mozilla.org/show_bug.cgi?id=1895994 + * + * The page uses a meta viewport tag on Android, and also hides overflow-x + * on the body tag, making it impossible to scroll the page. We can unset + * the overflow to fix this. + */ + +body { + overflow-x: auto; +} diff --git a/browser/extensions/webcompat/injections/css/bug1896349-vivaldi.com-selected-text-fix.css b/browser/extensions/webcompat/injections/css/bug1896349-vivaldi.com-selected-text-fix.css new file mode 100644 index 000000000000..884c0b84f390 --- /dev/null +++ b/browser/extensions/webcompat/injections/css/bug1896349-vivaldi.com-selected-text-fix.css @@ -0,0 +1,13 @@ +/* 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/. */ + +/** + * vivaldi.com - Selected text is invisible + * Bug #1896349 - https://bugzilla.mozilla.org/show_bug.cgi?id=1896349 + * WebCompat issue #136863 - https://webcompat.com/issues/136863 + */ +::selection { + color: HighlightText; + background-color: Highlight; +} diff --git a/browser/extensions/webcompat/injections/css/bug1896571-gracobaby.ca-unlock-scrolling.css b/browser/extensions/webcompat/injections/css/bug1896571-gracobaby.ca-unlock-scrolling.css new file mode 100644 index 000000000000..0d11b1ad4c02 --- /dev/null +++ b/browser/extensions/webcompat/injections/css/bug1896571-gracobaby.ca-unlock-scrolling.css @@ -0,0 +1,18 @@ +/* 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/. */ + +/** + * gracobaby.ca - users cannot scroll the page on narrow viewports + * Bug #1896571 - https://bugzilla.mozilla.org/show_bug.cgi?id=1896571 + * + * The page uses a meta viewport on narrower screen widths, and also + * hides overflow on the html tag, making it impossible to scroll the + * page. We can unset the overflow to fix this. + */ + +@media (max-width: 767.98px) { + html { + overflow: auto; + } +} diff --git a/browser/extensions/webcompat/injections/js/bug1841730-www.korg.com-fix-broken-page-loads.js b/browser/extensions/webcompat/injections/js/bug1841730-www.korg.com-fix-broken-page-loads.js new file mode 100644 index 000000000000..b6fdeae730a0 --- /dev/null +++ b/browser/extensions/webcompat/injections/js/bug1841730-www.korg.com-fix-broken-page-loads.js @@ -0,0 +1,35 @@ +/* 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 1841730 - Fix www.korg.com support download page loads on Windows. + * WebCompat issue #2787 - https://webcompat.com/issues/2787 + * + * They are using a library named PACE, which has a timing bug with Firefox + * which breaks page loads (due to a stuck progress indicator) on Windows. + * This is the fix suggested at https://github.com/CodeByZach/pace/issues/510 + */ + +/* globals exportFunction */ + +(function () { + const win = window.wrappedJSObject; + + let val = new win.Object(); + val.eventLag = false; + + Object.defineProperty(win, "paceOptions", { + configurable: true, + + get: exportFunction(function () { + return val; + }, window), + + set: exportFunction(function (_val) { + val = _val; + }, window), + }); +})(); diff --git a/browser/extensions/webcompat/injections/js/bug1881922-disable-legacy-mutation-events.js b/browser/extensions/webcompat/injections/js/bug1881922-disable-legacy-mutation-events.js new file mode 100644 index 000000000000..970f28cc565f --- /dev/null +++ b/browser/extensions/webcompat/injections/js/bug1881922-disable-legacy-mutation-events.js @@ -0,0 +1,43 @@ +/* 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"; + +/** + * Bugs 1881922, 1901780 - Disable legacy DOM Mutation Events to prevent performance issues. + */ + +/* globals exportFunction */ + +let bug = "1881922"; +if (location.origin.includes("vanbreda")) { + bug = "1901780"; +} +console.info( + `DOM Mutation Events have been disabled to prevent performance issues. See https://bugzilla.mozilla.org/show_bug.cgi?id=${bug} for details.` +); + +(function disableMutationEvents() { + const whichEvents = [ + "domattrmodified", + "domcharacterdatamodified", + "domnodeinserted", + "domnodeinsertedintodocument", + "domnoderemoved", + "domnoderemovedfromdocument", + "domsubtreemodified", + ]; + + const { prototype } = window.wrappedJSObject.EventTarget; + const { addEventListener } = prototype; + Object.defineProperty(prototype, "addEventListener", { + value: exportFunction(function (_type, b, c, d) { + const type = _type?.toLowerCase(); + if (whichEvents.includes(type)) { + return undefined; + } + return addEventListener.call(this, type, b, c, d); + }, window), + }); +})(); diff --git a/browser/extensions/webcompat/injections/js/bug1889326-office365-email-handling-prompt-autohide.js b/browser/extensions/webcompat/injections/js/bug1889326-office365-email-handling-prompt-autohide.js new file mode 100644 index 000000000000..765de30f1bbe --- /dev/null +++ b/browser/extensions/webcompat/injections/js/bug1889326-office365-email-handling-prompt-autohide.js @@ -0,0 +1,36 @@ +/* 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 1889326 - Office 365 email handling prompt autohide + * + * This site patch prevents the notification bar on Office 365 + * apps from popping up on each page-load, offering to handle + * email with Outlook. + */ + +/* globals exportFunction */ + +const warning = + "Office 365 Outlook email handling prompt has been hidden. See https://bugzilla.mozilla.org/show_bug.cgi?id=1889326 for details."; + +const localStorageKey = "mailProtocolHandlerAlreadyOffered"; + +const nav = navigator.wrappedJSObject; +const { registerProtocolHandler } = nav; +const { localStorage } = window.wrappedJSObject; + +Object.defineProperty(navigator.wrappedJSObject, "registerProtocolHandler", { + value: exportFunction(function (scheme, url, title) { + if (localStorage.getItem(localStorageKey)) { + console.info(warning); + return undefined; + } + registerProtocolHandler.call(nav, scheme, url, title); + localStorage.setItem(localStorageKey, true); + return undefined; + }, window), +}); diff --git a/browser/extensions/webcompat/injections/js/bug1898952-digits.t-mobile.com.js b/browser/extensions/webcompat/injections/js/bug1898952-digits.t-mobile.com.js new file mode 100644 index 000000000000..bbb84a37abc6 --- /dev/null +++ b/browser/extensions/webcompat/injections/js/bug1898952-digits.t-mobile.com.js @@ -0,0 +1,68 @@ +/* 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 1898952 - Spoof navigator.userAgentData for digits.t-mobile.com + * Webcompat issue #119767 - https://webcompat.com/issues/119767 + * + * The site blocks Firefox and Safari, reading info from userAgentData. + */ + +/* globals exportFunction, cloneInto */ + +if (!navigator.userAgentData) { + console.info( + "navigator.userAgentData has been overridden for compatibility reasons. See https://webcompat.com/issues/119767 for details." + ); + + const ua = navigator.userAgent; + const mobile = ua.includes("Mobile") || ua.includes("Tablet"); + + // Very roughly matches Chromium's GetPlatformForUAMetadata() + let platform = "Linux"; + if (mobile) { + platform = "Android"; + } else if (navigator.platform.startsWith("Win")) { + platform = "Windows"; + } else if (navigator.platform.startsWith("Mac")) { + platform = "macOS"; + } + + const version = (ua.match(/Firefox\/([0-9.]+)/) || ["", "58.0"])[1]; + + // These match Chrome's output as of version 126. + const brands = [ + { + brand: "Not/A)Brand", + version: "8", + }, + { + brand: "Chromium", + version, + }, + { + brand: "Google Chrome", + version, + }, + ]; + + const userAgentData = cloneInto( + { + brands, + mobile, + platform, + }, + window + ); + + Object.defineProperty(window.navigator.wrappedJSObject, "userAgentData", { + get: exportFunction(function () { + return userAgentData; + }, window), + + set: exportFunction(function () {}, window), + }); +} diff --git a/browser/extensions/webcompat/injections/js/bug1899937-plus.nhk.jp-request-picture-in-picture.js b/browser/extensions/webcompat/injections/js/bug1899937-plus.nhk.jp-request-picture-in-picture.js new file mode 100644 index 000000000000..d78784eb97d6 --- /dev/null +++ b/browser/extensions/webcompat/injections/js/bug1899937-plus.nhk.jp-request-picture-in-picture.js @@ -0,0 +1,27 @@ +/* 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 1899937 - Shim requestPictureInPicture for plus.nhk.jp + * WebCompat issue #103463 - https://webcompat.com/issues/103463 + * + * plus.nhk.jp is showing an error when attempting to play videos. + * Shimming requestPictureInPicture to `{}` makes the videos play. + */ + +/* globals exportFunction */ + +console.info( + "requestPictureInPicture was shimmed for compatibility reasons. See https://bugzilla.mozilla.org/show_bug.cgi?id=1899937 for details." +); + +const proto = HTMLVideoElement.wrappedJSObject.prototype; + +Object.defineProperty(proto, "requestPictureInPicture", { + value: exportFunction(function () { + return {}; + }, window), +}); diff --git a/browser/extensions/webcompat/injections/js/bug1924500-www.tiktok.com-fix-captcha-slider.js b/browser/extensions/webcompat/injections/js/bug1924500-www.tiktok.com-fix-captcha-slider.js new file mode 100644 index 000000000000..944bdd51e33b --- /dev/null +++ b/browser/extensions/webcompat/injections/js/bug1924500-www.tiktok.com-fix-captcha-slider.js @@ -0,0 +1,71 @@ +/* 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 1924500 - Fix www.tiktok.com captcha slider + * WebCompat issue #142709 - https://webcompat.com/issues/142709 + * + * They are relying on drag events having clientX coordinates, which are + * always zero on Firefox. A work-around is to listen for mousemove and + * dragover events to capture the clientX value from them, and then + * pass the value along when they reads a DragEvent.clientX. + */ + +/* globals exportFunction */ + +(function () { + let lastClientX = 0; + + const win = window.wrappedJSObject; + Object.defineProperty(win.DragEvent.prototype, "clientX", { + get: exportFunction(function () { + return lastClientX; + }, window), + set: exportFunction(function () {}, window), + configurable: true, + }); + + function setLastClientX(evt) { + lastClientX = evt.clientX; + } + + const captchaOverlayQuery = ".TUXModal-overlay"; + + function activate() { + document.documentElement.addEventListener("mousemove", setLastClientX); + document.documentElement.addEventListener("dragover", setLastClientX); + } + + function deactivate() { + lastClientX = 0; + document.documentElement.removeEventListener("mousemove", setLastClientX); + document.documentElement.removeEventListener("dragover", setLastClientX); + } + + const captchaObserver = new MutationObserver(mutations => { + for (let { addedNodes, removedNodes } of mutations) { + for (const node of addedNodes) { + try { + if (node.matches(captchaOverlayQuery)) { + activate(); + } + } catch (_) {} + } + for (const node of removedNodes) { + try { + if (node.matches(captchaOverlayQuery)) { + deactivate(); + } + } catch (_) {} + } + } + }); + + captchaObserver.observe(document.documentElement, { + childList: true, + subtree: true, + }); +})(); diff --git a/browser/extensions/webcompat/lib/ua_overrides.js b/browser/extensions/webcompat/lib/ua_overrides.js index dd3bef2393e1..9c9a300b73c0 100644 --- a/browser/extensions/webcompat/lib/ua_overrides.js +++ b/browser/extensions/webcompat/lib/ua_overrides.js @@ -144,13 +144,14 @@ class UAOverrides { async registerUAOverrides() { const platformMatches = ["all"]; - let platformInfo = await browser.runtime.getPlatformInfo(); - platformMatches.push(platformInfo.os == "android" ? "android" : "desktop"); + const { os } = await browser.runtime.getPlatformInfo(); + platformMatches.push(os); + platformMatches.push(os == "android" ? "android" : "desktop"); for (const override of this._availableOverrides) { if (platformMatches.includes(override.platform)) { override.availableOnPlatform = true; - override.currentPlatform = platformInfo.os; + override.currentPlatform = os; // If there is a specific about:config preference governing // this override, monitor its state. diff --git a/browser/extensions/webcompat/manifest.json b/browser/extensions/webcompat/manifest.json index 6a0bed76e051..8d72b0f8e4e7 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": "128.5.0", + "version": "133.2.0", "browser_specific_settings": { "gecko": { "id": "webcompat@mozilla.org", @@ -120,6 +120,7 @@ "shims/facebook-sdk.js", "shims/facebook.svg", "shims/fastclick.js", + "shims/figshare.js", "shims/firebase.js", "shims/google-ads.js", "shims/google-analytics-and-tag-manager.js", diff --git a/browser/extensions/webcompat/moz.build b/browser/extensions/webcompat/moz.build index fe0fbdb90280..2d92ca2ce0f2 100644 --- a/browser/extensions/webcompat/moz.build +++ b/browser/extensions/webcompat/moz.build @@ -56,6 +56,7 @@ FINAL_TARGET_FILES.features["webcompat@mozilla.org"]["injections"]["css"] += [ "injections/css/bug1765947-veniceincoming.com-left-fix.css", "injections/css/bug1770962-coldwellbankerhomes.com-image-height.css", "injections/css/bug1774490-rainews.it-gallery-fix.css", + "injections/css/bug1779908-play.google.com-scrollbar-fix.css", "injections/css/bug1784141-aveeno.com-acuvue.com-unsupported.css", "injections/css/bug1784199-entrata-platform-unsupported.css", "injections/css/bug1819678-nppes.cms.hhs.gov-unsupported-banner.css", @@ -67,14 +68,20 @@ FINAL_TARGET_FILES.features["webcompat@mozilla.org"]["injections"]["css"] += [ "injections/css/bug1830813-page.onstove.com-hide-unsupported.css", "injections/css/bug1836103-autostar-novoross.ru-make-map-taller.css", "injections/css/bug1836105-cnn.com-fix-blank-pages-when-printing.css", + "injections/css/bug1836872-docs.google.com-font-submenus-inaccessible.css", "injections/css/bug1848711-vio.com-page-height.css", "injections/css/bug1848713-cleanrider.com-slider.css", "injections/css/bug1848849-theaa.com-printing-mode-fix.css", "injections/css/bug1849388-kucharkaprodceru.cz-scroll-fix.css", + "injections/css/bug1856915-login.yahoo.com-unhide-password-button-fix.css", "injections/css/bug1868345-tvmovie.de-scroll-fix.css", - "injections/css/bug1877346-offerup.com-infinite-scroll-fix.css", - "injections/css/bug1882040-disable-pull-to-refresh.css", + "injections/css/bug1879879-developers.pinterest.com-list-alignment-fix.css", "injections/css/bug1884842-foodora.cz-height-fix.css", + "injections/css/bug1886616-www.six-group.com-select-fix.css", + "injections/css/bug1895051-www.zhihu.com-broken-button-fix.css", + "injections/css/bug1895994-softtrans.ro-unlock-scrolling.css", + "injections/css/bug1896349-vivaldi.com-selected-text-fix.css", + "injections/css/bug1896571-gracobaby.ca-unlock-scrolling.css", ] FINAL_TARGET_FILES.features["webcompat@mozilla.org"]["injections"]["js"] += [ @@ -99,14 +106,20 @@ FINAL_TARGET_FILES.features["webcompat@mozilla.org"]["injections"]["js"] += [ "injections/js/bug1830776-blueshieldca.com-unsupported.js", "injections/js/bug1831007-nintendo-window-OnetrustActiveGroups.js", "injections/js/bug1836157-thai-masszazs-niceScroll-disable.js", + "injections/js/bug1841730-www.korg.com-fix-broken-page-loads.js", "injections/js/bug1842437-www.youtube.com-performance-now-precision.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", "injections/js/bug1864564-esri-transfrom-names-shim.js", + "injections/js/bug1881922-disable-legacy-mutation-events.js", + "injections/js/bug1889326-office365-email-handling-prompt-autohide.js", "injections/js/bug1896383-error-capturestacktrace-shim.js", "injections/js/bug1897120-turnjs-zoom-fix.js", + "injections/js/bug1898952-digits.t-mobile.com.js", + "injections/js/bug1899937-plus.nhk.jp-request-picture-in-picture.js", + "injections/js/bug1924500-www.tiktok.com-fix-captcha-slider.js", ] FINAL_TARGET_FILES.features["webcompat@mozilla.org"]["shims"] += [ @@ -132,6 +145,7 @@ FINAL_TARGET_FILES.features["webcompat@mozilla.org"]["shims"] += [ "shims/facebook-sdk.js", "shims/facebook.svg", "shims/fastclick.js", + "shims/figshare.js", "shims/firebase.js", "shims/google-ads.js", "shims/google-analytics-and-tag-manager.js", diff --git a/browser/extensions/webcompat/shims/figshare.js b/browser/extensions/webcompat/shims/figshare.js new file mode 100644 index 000000000000..4f7bb0058fd8 --- /dev/null +++ b/browser/extensions/webcompat/shims/figshare.js @@ -0,0 +1,82 @@ +/* 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 1895990 - figshare login broken with dFPI enabled + * + * The websites that use figshare for login require unpartitioned third-party + * cookie access for https://figshare.com. The figshare login process sets a + * third-party cookie for https://figshare.com, which is used as an proof of + * authentication on redirect back to the main site. This shim adds a request + * for storage access for https://figshare.com when the user tries to log in. + */ + +// Third-party origin we need to request storage access for. +const STORAGE_ACCESS_ORIGIN = "https://figshare.com"; + +console.warn( + `When logging in, Firefox calls the Storage Access API on behalf of the site. See https://bugzilla.mozilla.org/show_bug.cgi?id=1895990 for details.` +); + +document.documentElement.addEventListener( + "click", + e => { + const { target, isTrusted } = e; + if (!isTrusted) { + return; + } + + // If the user clicks the login link, we need to request storage access + // for https://figshare.com. + const link = target.closest(`a[href^="https://login.figshare.com"]`); + if (!link) { + return; + } + + console.warn( + "Calling the Storage Access API on behalf of " + STORAGE_ACCESS_ORIGIN + ); + + e.stopPropagation(); + e.preventDefault(); + document.requestStorageAccessForOrigin(STORAGE_ACCESS_ORIGIN).then(() => { + link.click(); + }); + }, + true +); + +function watchFirefoxNotificationDialogAndHide() { + const observer = new MutationObserver((mutations, obs) => { + const element = document.querySelector( + "div[data-alerts-channel='firefox-notifications']" + ); + if (element) { + element.style.display = "none"; + obs.disconnect(); // Stop observing once we've found and hidden the element + } + }); + + // Start observing the document. + observer.observe(document.body, { + childList: true, + subtree: true, + }); +} + +// Hide the Firefox error notification +const notificationElement = document.querySelector( + "div[data-alerts-channel='firefox-notifications']" +); +if (notificationElement) { + notificationElement.style.display = "none"; +} else { + // Add a listener to watch for the Firefox notification element to load. + window.addEventListener( + "DOMContentLoaded", + watchFirefoxNotificationDialogAndHide + ); +} diff --git a/mobile/android/android-components/components/feature/webcompat/src/main/assets/extensions/webcompat/data/injections.js b/mobile/android/android-components/components/feature/webcompat/src/main/assets/extensions/webcompat/data/injections.js index 215c0c399c3c..b8d89ae9d65a 100644 --- a/mobile/android/android-components/components/feature/webcompat/src/main/assets/extensions/webcompat/data/injections.js +++ b/mobile/android/android-components/components/feature/webcompat/src/main/assets/extensions/webcompat/data/injections.js @@ -290,6 +290,8 @@ const AVAILABLE_INJECTIONS = [ "*://www.facebook.com/*", // Bug 1739489 "*://twitter.com/*", // Bug 1776229 "*://mobile.twitter.com/*", // Bug 1776229 + "*://x.com/*", // Bug 1776229 + "*://mobile.x.com/*", // Bug 1776229 "*://*.reddit.com/*", // Bug 1829755 ], js: [ @@ -585,6 +587,7 @@ const AVAILABLE_INJECTIONS = [ "*://*.lafoodbank.org/*", // 127006 "*://rutamayacoffee.com/*", // 129353 "*://ottoandspike.com.au/*", // bugzilla 1644602 + "*://give.umrelief.org/give/*", // bugzilla 1916407 ], js: [ { @@ -1001,20 +1004,6 @@ const AVAILABLE_INJECTIONS = [ ], }, }, - { - id: "bug1877346", - platform: "android", - domain: "offerup.com", - bug: "1877346", - contentScripts: { - matches: ["*://offerup.com/*"], - css: [ - { - file: "injections/css/bug1877346-offerup.com-infinite-scroll-fix.css", - }, - ], - }, - }, { id: "bug1884842", platform: "android", @@ -1059,15 +1048,108 @@ const AVAILABLE_INJECTIONS = [ }, }, { - id: "1882040", - platform: "android", - domain: "YouTube Shorts", - bug: "1882040", + id: "1922175", + platform: "all", + domain: "app.livingsecurity.com", + bug: "1922175", contentScripts: { - matches: ["*://m.youtube.com/shorts", "*://m.youtube.com/shorts/*"], + matches: ["*://app.livingsecurity.com/*"], + js: [ + { + file: "injections/js/bug1896383-error-capturestacktrace-shim.js", + }, + ], + }, + }, + { + id: "bug1889326", + platform: "desktop", + domain: "Office 365 email handling prompt", + bug: "1889326", + contentScripts: { + matches: [ + "*://*.live.com/*", + "*://*.office.com/*", + "*://*.office365.com/*", + "*://*.office365.us/*", + "*://*.outlook.cn/*", + "*://*.outlook.com/*", + "*://*.sharepoint.com/*", + ], + js: [ + { + file: "injections/js/bug1889326-office365-email-handling-prompt-autohide.js", + }, + ], + allFrames: true, + }, + }, + { + id: "bug1881922", + platform: "all", + domain: "helpdeskgeek.com", + bug: "1881922", + contentScripts: { + matches: ["*://helpdeskgeek.com/*"], + js: [ + { + file: "injections/js/bug1881922-disable-legacy-mutation-events.js", + }, + ], + }, + }, + { + id: "bug1901780", + platform: "all", + domain: "vanbreda-health.be", + bug: "1901780", + contentScripts: { + matches: ["*://www.vanbreda-health.be/*"], + js: [ + { + file: "injections/js/bug1881922-disable-legacy-mutation-events.js", + }, + ], + }, + }, + { + id: "bug1896571", + platform: "all", + domain: "gracobaby.ca", + bug: "1896571", + contentScripts: { + matches: ["*://www.gracobaby.ca/*"], css: [ { - file: "injections/css/bug1882040-disable-pull-to-refresh.css", + file: "injections/css/bug1896571-gracobaby.ca-unlock-scrolling.css", + }, + ], + }, + }, + { + id: "bug1895994", + platform: "android", + domain: "www.softrans.ro", + bug: "1895994", + contentScripts: { + matches: ["*://*.softrans.ro/*"], + css: [ + { + file: "injections/css/bug1895994-softtrans.ro-unlock-scrolling.css", + }, + ], + }, + }, + { + id: "bug1898952", + platform: "desktop", + domain: "digits.t-mobile.com", + bug: "1898952", + contentScripts: { + matches: ["*://digits.t-mobile.com/*"], + js: [ + { + file: "injections/js/bug1898952-digits.t-mobile.com.js", }, ], }, @@ -1094,6 +1176,146 @@ const AVAILABLE_INJECTIONS = [ allFrames: true, }, }, + { + id: "bug1899937", + platform: "all", + domain: "plus.nhk.jp", + bug: "1899937", + contentScripts: { + matches: ["*://plus.nhk.jp/*"], + js: [ + { + file: "injections/js/bug1899937-plus.nhk.jp-request-picture-in-picture.js", + }, + ], + }, + }, + { + id: "bug1886616", + platform: "all", + domain: "www.six-group.com", + bug: "1886616", + contentScripts: { + matches: ["*://www.six-group.com/*/market-data/etf/etf-explorer.html*"], + css: [ + { + file: "injections/css/bug1886616-www.six-group.com-select-fix.css", + }, + ], + }, + }, + { + id: "bug1896349", + platform: "all", + domain: "vivaldi.com", + bug: "1896349", + contentScripts: { + matches: ["*://vivaldi.com/*"], + css: [ + { + file: "injections/css/bug1896349-vivaldi.com-selected-text-fix.css", + }, + ], + }, + }, + { + id: "bug1836872", + platform: "desktop", + domain: "docs.google.com", + bug: "1836872", + contentScripts: { + matches: ["*://docs.google.com/document/*"], + css: [ + { + file: "injections/css/bug1836872-docs.google.com-font-submenus-inaccessible.css", + }, + ], + }, + }, + { + id: "bug1779908", + platform: "desktop", + domain: "docs.google.com", + bug: "1779908", + contentScripts: { + matches: ["*://play.google.com/store/*"], + css: [ + { + file: "injections/css/bug1779908-play.google.com-scrollbar-fix.css", + }, + ], + }, + }, + { + id: "bug1879879", + platform: "all", + domain: "developers.pinterest.com", + bug: "1879879", + contentScripts: { + matches: ["*://developers.pinterest.com/docs/*"], + css: [ + { + file: "injections/css/bug1879879-developers.pinterest.com-list-alignment-fix.css", + }, + ], + }, + }, + { + id: "bug1856915", + platform: "android", + domain: "login.yahoo.com", + bug: "1856915", + contentScripts: { + matches: ["*://login.yahoo.com/account/*"], + css: [ + { + file: "injections/css/bug1856915-login.yahoo.com-unhide-password-button-fix.css", + }, + ], + }, + }, + { + id: "bug1841730", + platform: "desktop", + domain: "www.korg.com", + bug: "1841730", + contentScripts: { + matches: ["*://www.korg.com/*/support/download/product/*"], + js: [ + { + file: "injections/js/bug1841730-www.korg.com-fix-broken-page-loads.js", + }, + ], + }, + }, + { + id: "bug1895051", + platform: "all", + domain: "www.zhihu.com", + bug: "1895051", + contentScripts: { + matches: ["*://www.zhihu.com/question/*"], + css: [ + { + file: "injections/css/bug1895051-www.zhihu.com-broken-button-fix.css", + }, + ], + }, + }, + { + id: "bug1924500", + platform: "desktop", + domain: "www.tiktok.com", + bug: "1924500", + contentScripts: { + matches: ["*://www.tiktok.com/*"], + js: [ + { + file: "injections/js/bug1924500-www.tiktok.com-fix-captcha-slider.js", + }, + ], + }, + }, ]; module.exports = AVAILABLE_INJECTIONS; diff --git a/mobile/android/android-components/components/feature/webcompat/src/main/assets/extensions/webcompat/data/shims.js b/mobile/android/android-components/components/feature/webcompat/src/main/assets/extensions/webcompat/data/shims.js index ab7234c217df..ac6f86ad8499 100644 --- a/mobile/android/android-components/components/feature/webcompat/src/main/assets/extensions/webcompat/data/shims.js +++ b/mobile/android/android-components/components/feature/webcompat/src/main/assets/extensions/webcompat/data/shims.js @@ -379,6 +379,27 @@ const AVAILABLE_SHIMS = [ ], onlyIfBlockedByETP: true, }, + { + id: "figshare", + platform: "all", + name: "Figshare", + bug: "1895990", + contentScripts: [ + { + js: "figshare.js", + matches: [ + "*://*.figsharelabs.io/*", + "*://opal.latrobe.edu.au/*", + "*://repository.lboro.ac.uk/*", + "*://portal.sds.ox.ac.uk/*", + "*://curate.nd.edu/*", + "*://kilthub.cmu.edu/*", + ], + runAt: "document_start", + }, + ], + onlyIfDFPIActive: true, + }, { id: "GoogleAnalyticsAndTagManager", platform: "all", diff --git a/mobile/android/android-components/components/feature/webcompat/src/main/assets/extensions/webcompat/data/ua_overrides.js b/mobile/android/android-components/components/feature/webcompat/src/main/assets/extensions/webcompat/data/ua_overrides.js index 23d17fb1d91c..21d8d9271279 100644 --- a/mobile/android/android-components/components/feature/webcompat/src/main/assets/extensions/webcompat/data/ua_overrides.js +++ b/mobile/android/android-components/components/feature/webcompat/src/main/assets/extensions/webcompat/data/ua_overrides.js @@ -1210,6 +1210,254 @@ const AVAILABLE_UA_OVERRIDES = [ }, }, }, + { + /* + * Bug 1842767 - UA override for passport.bilibili.com + * + * Spoofing as Chrome makes the login page use a mobile layout. + */ + id: "bug1842767", + platform: "android", + domain: "passport.bilibili.com", + bug: "1842767", + config: { + matches: ["*://*.passport.bilibili.com/*"], + uaTransformer: () => { + return UAHelpers.getDeviceAppropriateChromeUA(); + }, + }, + }, + { + /* + * Bug 1896354 - UA override for my.rhinoshield.fr + * + * Sites only supports Chrome, but seems to work with a UA spoof. + */ + id: "bug1896354", + platform: "all", + domain: "my.rhinoshield.fr", + bug: "1896354", + config: { + matches: ["*://my.rhinoshield.fr/*"], + uaTransformer: () => { + return UAHelpers.getDeviceAppropriateChromeUA(); + }, + }, + }, + { + /* + * Bug 1813177 - UA override for rbi.org.in + * + * The site endlessly redirects for a Firefox mobile UA string. + */ + id: "bug1813177", + platform: "android", + domain: "m.rbi.org.in", + bug: "1813177", + config: { + matches: ["*://m.rbi.org.in/*"], + uaTransformer: () => { + return UAHelpers.getDeviceAppropriateChromeUA(); + }, + }, + }, + { + /* + * Bug 1903970 - UA override for unimedlitoral.com.br + * Webcompat issue #138342 - https://webcompat.com/issues/138342 + * + * Site blocks Firefox, but seems to work with a UA spoof. + */ + id: "bug1903970", + platform: "all", + domain: "www.unimedlitoral.com.br", + bug: "1903970", + config: { + matches: ["*://www.unimedlitoral.com.br/agendaonline/*"], + uaTransformer: () => { + return UAHelpers.getDeviceAppropriateChromeUA(); + }, + }, + }, + { + /* + * Bug 1902474 - UA override for lg.jio.com + * Webcompat issue #124681 - https://webcompat.com/issues/124681 + * + * Site incorrectly blocks Firefox on Android. A desktop UA works. + */ + id: "bug1902474", + platform: "android", + domain: "lg.jio.com", + bug: "1902474", + config: { + matches: ["*://lg.jio.com/*"], + uaTransformer: originalUA => { + return originalUA.replace(/ (Mobile|Tablet);/, ""); + }, + }, + }, + { + /* + * Bug 1909448 - UA override for fire.honeywell.com + * + * Site doesn't load on Firefox, but works fine with a UA spoof. + */ + id: "bug1909448", + platform: "all", + domain: "fire.honeywell.com", + bug: "1909448", + config: { + matches: ["*://fire.honeywell.com/*"], + uaTransformer: () => { + return UAHelpers.getDeviceAppropriateChromeUA(); + }, + }, + }, + { + /* + * Bug 1899937 - UA override for plus.nhk.jp + * Webcompat issue #103463 - https://webcompat.com/issues/103463 + * + * Site blocks Firefox, so a UA spoof and an intervention is needed. + */ + id: "bug1899937-ua", + platform: "all", + domain: "plus.nhk.jp", + bug: "1899937", + config: { + matches: ["*://plus.nhk.jp/*"], + uaTransformer: () => { + return UAHelpers.getDeviceAppropriateChromeUA(); + }, + }, + }, + { + /* + * Bug 1897724 - UA override for app.homewyse.com + * Webcompat issue #137164 - https://webcompat.com/issues/137164 + * + * Site blocks Firefox, but seems to work with a UA spoof. + */ + id: "bug1897724", + platform: "all", + domain: "app.homewyse.com", + bug: "1897724", + config: { + matches: ["*://app.homewyse.com/*"], + uaTransformer: () => { + return UAHelpers.getDeviceAppropriateChromeUA(); + }, + }, + }, + { + /* + * Bug 1898923 - UA override for trade-in.vodafone.com + * Webcompat issue #127158 - https://webcompat.com/issues/127158 + * + * Site blocks Firefox, but seems to work with a UA spoof. + */ + id: "bug1898923", + platform: "all", + domain: "trade-in.vodafone.com", + bug: "1898923", + config: { + matches: ["*://trade-in.vodafone.com/*"], + uaTransformer: () => { + return UAHelpers.getDeviceAppropriateChromeUA(); + }, + }, + }, + { + /* + * Bug 1899067 - UA override for game.granbluefantasy.jp + * Webcompat issue #43155 - https://webcompat.com/issues/43155 + * + * Site blocks Firefox, but seems to work with a UA spoof. + */ + id: "bug1899067", + platform: "desktop", + domain: "game.granbluefantasy.jp", + bug: "1899067", + config: { + matches: ["*://game.granbluefantasy.jp/*"], + uaTransformer: () => { + return UAHelpers.getDeviceAppropriateChromeUA(); + }, + }, + }, + { + /* + * Bug 1898941 - UA override for events.webinar.ru + * Webcompat issue #121871 - https://webcompat.com/issues/121871 + * + * Site blocks Firefox, but seems to work with a UA spoof. + */ + id: "bug1898941", + platform: "all", + domain: "events.webinar.ru", + bug: "1898941", + config: { + matches: ["*://events.webinar.ru/*"], + uaTransformer: () => { + return UAHelpers.getDeviceAppropriateChromeUA(); + }, + }, + }, + { + /* + * Bug 1919004 - UA override for www.editoracontexto.com.br + * Webcompat issue #141641 - https://webcompat.com/issues/141641 + * + * Site presents its desktop CSS to Firefox on Android. + */ + id: "bug1919004", + platform: "android", + domain: "www.editoracontexto.com.br", + bug: "1919004", + config: { + matches: ["*://www.editoracontexto.com.br/*"], + uaTransformer: () => { + return UAHelpers.getDeviceAppropriateChromeUA(); + }, + }, + }, + { + /* + * Bug 1921410 - UA override for beta.maps.apple.com + * Webcompat issue #140205 - https://webcompat.com/issues/140205 + * + * Apple Maps beta artifically blocks Linux. + */ + id: "bug1921410", + platform: "linux", + domain: "beta.maps.apple.com", + bug: "1921410", + config: { + matches: ["*://beta.maps.apple.com/*"], + uaTransformer: originalUA => { + return UAHelpers.getWindowsUA(originalUA); + }, + }, + }, + { + /* + * Bug 1899948 - UA override for tv.partner.co.il + * Webcompat issue #64703 - https://webcompat.com/issues/64703 + * + * Site blocks Firefox, but seems to work with a UA spoof. + */ + id: "1899948", + platform: "all", + domain: "tv.partner.co.il", + bug: "1899948", + config: { + matches: ["*://tv.partner.co.il/*"], + uaTransformer: () => { + return UAHelpers.getDeviceAppropriateChromeUA(); + }, + }, + }, ]; module.exports = AVAILABLE_UA_OVERRIDES; diff --git a/mobile/android/android-components/components/feature/webcompat/src/main/assets/extensions/webcompat/injections/css/bug1779908-play.google.com-scrollbar-fix.css b/mobile/android/android-components/components/feature/webcompat/src/main/assets/extensions/webcompat/injections/css/bug1779908-play.google.com-scrollbar-fix.css new file mode 100644 index 000000000000..efed93cc9b09 --- /dev/null +++ b/mobile/android/android-components/components/feature/webcompat/src/main/assets/extensions/webcompat/injections/css/bug1779908-play.google.com-scrollbar-fix.css @@ -0,0 +1,15 @@ +/* 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/. */ + +/** + * play.google.com - Extra scrollbar not hidden on store pages. + * + * Bug #1779908 - https://bugzilla.mozilla.org/show_bug.cgi?id=1779908 + * + * They are hiding the scrollbar with ::webkit-scrollbar, but not the standards- + * compliant method `scrollbar-width:none`. + */ +.aoJE7e { + scrollbar-width: none; +} diff --git a/mobile/android/android-components/components/feature/webcompat/src/main/assets/extensions/webcompat/injections/css/bug1836872-docs.google.com-font-submenus-inaccessible.css b/mobile/android/android-components/components/feature/webcompat/src/main/assets/extensions/webcompat/injections/css/bug1836872-docs.google.com-font-submenus-inaccessible.css new file mode 100644 index 000000000000..fa332c3eafa0 --- /dev/null +++ b/mobile/android/android-components/components/feature/webcompat/src/main/assets/extensions/webcompat/injections/css/bug1836872-docs.google.com-font-submenus-inaccessible.css @@ -0,0 +1,18 @@ +/* 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/. */ + +/** + * docs.google.com - font submenus are inaccessible with overlay scrollbars on + * Bug #1836872 - https://bugzilla.mozilla.org/show_bug.cgi?id=1836872 + * + * The submenu panels are shifted too far to the right when overlay + * scrollbars are visible, and so they are dismissed while attemting + * to mouse over to them. Shifting them to the left fixes them. + */ +/* font family sub-menus */ +[class="goog-menu goog-menu-vertical"], +/* font style sub-menus */ +.goog-menu.apps-menu-hide-mnemonics { + margin-inline-start: -20px; +} diff --git a/mobile/android/android-components/components/feature/webcompat/src/main/assets/extensions/webcompat/injections/css/bug1856915-login.yahoo.com-unhide-password-button-fix.css b/mobile/android/android-components/components/feature/webcompat/src/main/assets/extensions/webcompat/injections/css/bug1856915-login.yahoo.com-unhide-password-button-fix.css new file mode 100644 index 000000000000..aebe2a3b84fb --- /dev/null +++ b/mobile/android/android-components/components/feature/webcompat/src/main/assets/extensions/webcompat/injections/css/bug1856915-login.yahoo.com-unhide-password-button-fix.css @@ -0,0 +1,15 @@ +/* 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/. */ + +/** + * login.yahoo.com - Toggle to reveal password text is missing + * + * Bug #1856915 - https://bugzilla.mozilla.org/show_bug.cgi?id=1856915 + * + * Yahoo is using letter-spacing in a way which relies on a Blink quirk to + * not inadvertently hide their show/hide password text toggle. + */ +#password-container > input[type="password"] { + min-width: 0; +} diff --git a/mobile/android/android-components/components/feature/webcompat/src/main/assets/extensions/webcompat/injections/css/bug1877346-offerup.com-infinite-scroll-fix.css b/mobile/android/android-components/components/feature/webcompat/src/main/assets/extensions/webcompat/injections/css/bug1877346-offerup.com-infinite-scroll-fix.css deleted file mode 100644 index 24681686f4bf..000000000000 --- a/mobile/android/android-components/components/feature/webcompat/src/main/assets/extensions/webcompat/injections/css/bug1877346-offerup.com-infinite-scroll-fix.css +++ /dev/null @@ -1,20 +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/. */ - -/** - * offerup.com - Infinite scroll doesn't work - * Bug #1720060 - https://bugzilla.mozilla.org/show_bug.cgi?id=1720060 - * - * The site uses IntersectionObserver to show new items on the page, - * as the page being scrolled and it doesn't work with with - * Dynamic Toolbar enabled. Adding an empty element after the content - * to make up for the height of the dynamic toolbar makes it work. - */ - -#__next::after { - display: block; - width: 100%; - height: 10px; - content: ""; -} diff --git a/mobile/android/android-components/components/feature/webcompat/src/main/assets/extensions/webcompat/injections/css/bug1879879-developers.pinterest.com-list-alignment-fix.css b/mobile/android/android-components/components/feature/webcompat/src/main/assets/extensions/webcompat/injections/css/bug1879879-developers.pinterest.com-list-alignment-fix.css new file mode 100644 index 000000000000..b93ab382c493 --- /dev/null +++ b/mobile/android/android-components/components/feature/webcompat/src/main/assets/extensions/webcompat/injections/css/bug1879879-developers.pinterest.com-list-alignment-fix.css @@ -0,0 +1,12 @@ +/* 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/. */ + +/** + * developers.pinterest.com - List elements are misaligned + * + * Bug #1879879 - https://bugzilla.mozilla.org/show_bug.cgi?id=1879879 + */ +li > span:has(> div) { + display: block; +} diff --git a/mobile/android/android-components/components/feature/webcompat/src/main/assets/extensions/webcompat/injections/css/bug1882040-disable-pull-to-refresh.css b/mobile/android/android-components/components/feature/webcompat/src/main/assets/extensions/webcompat/injections/css/bug1882040-disable-pull-to-refresh.css deleted file mode 100644 index b075f962124c..000000000000 --- a/mobile/android/android-components/components/feature/webcompat/src/main/assets/extensions/webcompat/injections/css/bug1882040-disable-pull-to-refresh.css +++ /dev/null @@ -1,14 +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/. */ - -/** - * m.youtube.com/shorts - pull-to-refresh breaks scrolling - * Bug #1882040 - https://bugzilla.mozilla.org/show_bug.cgi?id=1882040 - * - * Pull-to-refresh is breaking scrolling on the YouTube Shorts mobile page. - * The easiest work-around is to inject this CSS to disable it for now. - */ -html { - overscroll-behavior: contain; -} diff --git a/mobile/android/android-components/components/feature/webcompat/src/main/assets/extensions/webcompat/injections/css/bug1886616-www.six-group.com-select-fix.css b/mobile/android/android-components/components/feature/webcompat/src/main/assets/extensions/webcompat/injections/css/bug1886616-www.six-group.com-select-fix.css new file mode 100644 index 000000000000..e6587d45861f --- /dev/null +++ b/mobile/android/android-components/components/feature/webcompat/src/main/assets/extensions/webcompat/injections/css/bug1886616-www.six-group.com-select-fix.css @@ -0,0 +1,15 @@ +/* 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.six-group.com - Selected input values are hidden + * Bug #1886616 - https://bugzilla.mozilla.org/show_bug.cgi?id=1886616 + * WebCompat issue #129271 - https://webcompat.com/issues/129271 + * + * The page is hiding CSS content, which is not interoperable. In this + * case, it causes their select dropdown's values to be hidden. + */ +select { + content: normal; +} diff --git a/mobile/android/android-components/components/feature/webcompat/src/main/assets/extensions/webcompat/injections/css/bug1895051-www.zhihu.com-broken-button-fix.css b/mobile/android/android-components/components/feature/webcompat/src/main/assets/extensions/webcompat/injections/css/bug1895051-www.zhihu.com-broken-button-fix.css new file mode 100644 index 000000000000..136d79520486 --- /dev/null +++ b/mobile/android/android-components/components/feature/webcompat/src/main/assets/extensions/webcompat/injections/css/bug1895051-www.zhihu.com-broken-button-fix.css @@ -0,0 +1,16 @@ +/* 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.zhihu.com - Certain directory buttons are unclickable + * + * Bug #1895051 - https://bugzilla.mozilla.org/show_bug.cgi?id=1895051 + * + * On narrow enough screens, some of the site's directory buttons + * overlap with text differently on Firefox and Safari than in Chromium, + * making them unclickable. This fixes the issue. + */ +.css-376mun { + display: block; +} diff --git a/mobile/android/android-components/components/feature/webcompat/src/main/assets/extensions/webcompat/injections/css/bug1895994-softtrans.ro-unlock-scrolling.css b/mobile/android/android-components/components/feature/webcompat/src/main/assets/extensions/webcompat/injections/css/bug1895994-softtrans.ro-unlock-scrolling.css new file mode 100644 index 000000000000..85d0dc12ac36 --- /dev/null +++ b/mobile/android/android-components/components/feature/webcompat/src/main/assets/extensions/webcompat/injections/css/bug1895994-softtrans.ro-unlock-scrolling.css @@ -0,0 +1,16 @@ +/* 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/. */ + +/** + * softtrans.ro - users cannot scroll the page horizontally on Android + * Bug #1895994 - https://bugzilla.mozilla.org/show_bug.cgi?id=1895994 + * + * The page uses a meta viewport tag on Android, and also hides overflow-x + * on the body tag, making it impossible to scroll the page. We can unset + * the overflow to fix this. + */ + +body { + overflow-x: auto; +} diff --git a/mobile/android/android-components/components/feature/webcompat/src/main/assets/extensions/webcompat/injections/css/bug1896349-vivaldi.com-selected-text-fix.css b/mobile/android/android-components/components/feature/webcompat/src/main/assets/extensions/webcompat/injections/css/bug1896349-vivaldi.com-selected-text-fix.css new file mode 100644 index 000000000000..884c0b84f390 --- /dev/null +++ b/mobile/android/android-components/components/feature/webcompat/src/main/assets/extensions/webcompat/injections/css/bug1896349-vivaldi.com-selected-text-fix.css @@ -0,0 +1,13 @@ +/* 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/. */ + +/** + * vivaldi.com - Selected text is invisible + * Bug #1896349 - https://bugzilla.mozilla.org/show_bug.cgi?id=1896349 + * WebCompat issue #136863 - https://webcompat.com/issues/136863 + */ +::selection { + color: HighlightText; + background-color: Highlight; +} diff --git a/mobile/android/android-components/components/feature/webcompat/src/main/assets/extensions/webcompat/injections/css/bug1896571-gracobaby.ca-unlock-scrolling.css b/mobile/android/android-components/components/feature/webcompat/src/main/assets/extensions/webcompat/injections/css/bug1896571-gracobaby.ca-unlock-scrolling.css new file mode 100644 index 000000000000..0d11b1ad4c02 --- /dev/null +++ b/mobile/android/android-components/components/feature/webcompat/src/main/assets/extensions/webcompat/injections/css/bug1896571-gracobaby.ca-unlock-scrolling.css @@ -0,0 +1,18 @@ +/* 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/. */ + +/** + * gracobaby.ca - users cannot scroll the page on narrow viewports + * Bug #1896571 - https://bugzilla.mozilla.org/show_bug.cgi?id=1896571 + * + * The page uses a meta viewport on narrower screen widths, and also + * hides overflow on the html tag, making it impossible to scroll the + * page. We can unset the overflow to fix this. + */ + +@media (max-width: 767.98px) { + html { + overflow: auto; + } +} diff --git a/mobile/android/android-components/components/feature/webcompat/src/main/assets/extensions/webcompat/injections/js/bug1841730-www.korg.com-fix-broken-page-loads.js b/mobile/android/android-components/components/feature/webcompat/src/main/assets/extensions/webcompat/injections/js/bug1841730-www.korg.com-fix-broken-page-loads.js new file mode 100644 index 000000000000..b6fdeae730a0 --- /dev/null +++ b/mobile/android/android-components/components/feature/webcompat/src/main/assets/extensions/webcompat/injections/js/bug1841730-www.korg.com-fix-broken-page-loads.js @@ -0,0 +1,35 @@ +/* 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 1841730 - Fix www.korg.com support download page loads on Windows. + * WebCompat issue #2787 - https://webcompat.com/issues/2787 + * + * They are using a library named PACE, which has a timing bug with Firefox + * which breaks page loads (due to a stuck progress indicator) on Windows. + * This is the fix suggested at https://github.com/CodeByZach/pace/issues/510 + */ + +/* globals exportFunction */ + +(function () { + const win = window.wrappedJSObject; + + let val = new win.Object(); + val.eventLag = false; + + Object.defineProperty(win, "paceOptions", { + configurable: true, + + get: exportFunction(function () { + return val; + }, window), + + set: exportFunction(function (_val) { + val = _val; + }, window), + }); +})(); diff --git a/mobile/android/android-components/components/feature/webcompat/src/main/assets/extensions/webcompat/injections/js/bug1881922-disable-legacy-mutation-events.js b/mobile/android/android-components/components/feature/webcompat/src/main/assets/extensions/webcompat/injections/js/bug1881922-disable-legacy-mutation-events.js new file mode 100644 index 000000000000..970f28cc565f --- /dev/null +++ b/mobile/android/android-components/components/feature/webcompat/src/main/assets/extensions/webcompat/injections/js/bug1881922-disable-legacy-mutation-events.js @@ -0,0 +1,43 @@ +/* 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"; + +/** + * Bugs 1881922, 1901780 - Disable legacy DOM Mutation Events to prevent performance issues. + */ + +/* globals exportFunction */ + +let bug = "1881922"; +if (location.origin.includes("vanbreda")) { + bug = "1901780"; +} +console.info( + `DOM Mutation Events have been disabled to prevent performance issues. See https://bugzilla.mozilla.org/show_bug.cgi?id=${bug} for details.` +); + +(function disableMutationEvents() { + const whichEvents = [ + "domattrmodified", + "domcharacterdatamodified", + "domnodeinserted", + "domnodeinsertedintodocument", + "domnoderemoved", + "domnoderemovedfromdocument", + "domsubtreemodified", + ]; + + const { prototype } = window.wrappedJSObject.EventTarget; + const { addEventListener } = prototype; + Object.defineProperty(prototype, "addEventListener", { + value: exportFunction(function (_type, b, c, d) { + const type = _type?.toLowerCase(); + if (whichEvents.includes(type)) { + return undefined; + } + return addEventListener.call(this, type, b, c, d); + }, window), + }); +})(); diff --git a/mobile/android/android-components/components/feature/webcompat/src/main/assets/extensions/webcompat/injections/js/bug1889326-office365-email-handling-prompt-autohide.js b/mobile/android/android-components/components/feature/webcompat/src/main/assets/extensions/webcompat/injections/js/bug1889326-office365-email-handling-prompt-autohide.js new file mode 100644 index 000000000000..765de30f1bbe --- /dev/null +++ b/mobile/android/android-components/components/feature/webcompat/src/main/assets/extensions/webcompat/injections/js/bug1889326-office365-email-handling-prompt-autohide.js @@ -0,0 +1,36 @@ +/* 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 1889326 - Office 365 email handling prompt autohide + * + * This site patch prevents the notification bar on Office 365 + * apps from popping up on each page-load, offering to handle + * email with Outlook. + */ + +/* globals exportFunction */ + +const warning = + "Office 365 Outlook email handling prompt has been hidden. See https://bugzilla.mozilla.org/show_bug.cgi?id=1889326 for details."; + +const localStorageKey = "mailProtocolHandlerAlreadyOffered"; + +const nav = navigator.wrappedJSObject; +const { registerProtocolHandler } = nav; +const { localStorage } = window.wrappedJSObject; + +Object.defineProperty(navigator.wrappedJSObject, "registerProtocolHandler", { + value: exportFunction(function (scheme, url, title) { + if (localStorage.getItem(localStorageKey)) { + console.info(warning); + return undefined; + } + registerProtocolHandler.call(nav, scheme, url, title); + localStorage.setItem(localStorageKey, true); + return undefined; + }, window), +}); diff --git a/mobile/android/android-components/components/feature/webcompat/src/main/assets/extensions/webcompat/injections/js/bug1898952-digits.t-mobile.com.js b/mobile/android/android-components/components/feature/webcompat/src/main/assets/extensions/webcompat/injections/js/bug1898952-digits.t-mobile.com.js new file mode 100644 index 000000000000..bbb84a37abc6 --- /dev/null +++ b/mobile/android/android-components/components/feature/webcompat/src/main/assets/extensions/webcompat/injections/js/bug1898952-digits.t-mobile.com.js @@ -0,0 +1,68 @@ +/* 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 1898952 - Spoof navigator.userAgentData for digits.t-mobile.com + * Webcompat issue #119767 - https://webcompat.com/issues/119767 + * + * The site blocks Firefox and Safari, reading info from userAgentData. + */ + +/* globals exportFunction, cloneInto */ + +if (!navigator.userAgentData) { + console.info( + "navigator.userAgentData has been overridden for compatibility reasons. See https://webcompat.com/issues/119767 for details." + ); + + const ua = navigator.userAgent; + const mobile = ua.includes("Mobile") || ua.includes("Tablet"); + + // Very roughly matches Chromium's GetPlatformForUAMetadata() + let platform = "Linux"; + if (mobile) { + platform = "Android"; + } else if (navigator.platform.startsWith("Win")) { + platform = "Windows"; + } else if (navigator.platform.startsWith("Mac")) { + platform = "macOS"; + } + + const version = (ua.match(/Firefox\/([0-9.]+)/) || ["", "58.0"])[1]; + + // These match Chrome's output as of version 126. + const brands = [ + { + brand: "Not/A)Brand", + version: "8", + }, + { + brand: "Chromium", + version, + }, + { + brand: "Google Chrome", + version, + }, + ]; + + const userAgentData = cloneInto( + { + brands, + mobile, + platform, + }, + window + ); + + Object.defineProperty(window.navigator.wrappedJSObject, "userAgentData", { + get: exportFunction(function () { + return userAgentData; + }, window), + + set: exportFunction(function () {}, window), + }); +} diff --git a/mobile/android/android-components/components/feature/webcompat/src/main/assets/extensions/webcompat/injections/js/bug1899937-plus.nhk.jp-request-picture-in-picture.js b/mobile/android/android-components/components/feature/webcompat/src/main/assets/extensions/webcompat/injections/js/bug1899937-plus.nhk.jp-request-picture-in-picture.js new file mode 100644 index 000000000000..d78784eb97d6 --- /dev/null +++ b/mobile/android/android-components/components/feature/webcompat/src/main/assets/extensions/webcompat/injections/js/bug1899937-plus.nhk.jp-request-picture-in-picture.js @@ -0,0 +1,27 @@ +/* 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 1899937 - Shim requestPictureInPicture for plus.nhk.jp + * WebCompat issue #103463 - https://webcompat.com/issues/103463 + * + * plus.nhk.jp is showing an error when attempting to play videos. + * Shimming requestPictureInPicture to `{}` makes the videos play. + */ + +/* globals exportFunction */ + +console.info( + "requestPictureInPicture was shimmed for compatibility reasons. See https://bugzilla.mozilla.org/show_bug.cgi?id=1899937 for details." +); + +const proto = HTMLVideoElement.wrappedJSObject.prototype; + +Object.defineProperty(proto, "requestPictureInPicture", { + value: exportFunction(function () { + return {}; + }, window), +}); diff --git a/mobile/android/android-components/components/feature/webcompat/src/main/assets/extensions/webcompat/injections/js/bug1924500-www.tiktok.com-fix-captcha-slider.js b/mobile/android/android-components/components/feature/webcompat/src/main/assets/extensions/webcompat/injections/js/bug1924500-www.tiktok.com-fix-captcha-slider.js new file mode 100644 index 000000000000..944bdd51e33b --- /dev/null +++ b/mobile/android/android-components/components/feature/webcompat/src/main/assets/extensions/webcompat/injections/js/bug1924500-www.tiktok.com-fix-captcha-slider.js @@ -0,0 +1,71 @@ +/* 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 1924500 - Fix www.tiktok.com captcha slider + * WebCompat issue #142709 - https://webcompat.com/issues/142709 + * + * They are relying on drag events having clientX coordinates, which are + * always zero on Firefox. A work-around is to listen for mousemove and + * dragover events to capture the clientX value from them, and then + * pass the value along when they reads a DragEvent.clientX. + */ + +/* globals exportFunction */ + +(function () { + let lastClientX = 0; + + const win = window.wrappedJSObject; + Object.defineProperty(win.DragEvent.prototype, "clientX", { + get: exportFunction(function () { + return lastClientX; + }, window), + set: exportFunction(function () {}, window), + configurable: true, + }); + + function setLastClientX(evt) { + lastClientX = evt.clientX; + } + + const captchaOverlayQuery = ".TUXModal-overlay"; + + function activate() { + document.documentElement.addEventListener("mousemove", setLastClientX); + document.documentElement.addEventListener("dragover", setLastClientX); + } + + function deactivate() { + lastClientX = 0; + document.documentElement.removeEventListener("mousemove", setLastClientX); + document.documentElement.removeEventListener("dragover", setLastClientX); + } + + const captchaObserver = new MutationObserver(mutations => { + for (let { addedNodes, removedNodes } of mutations) { + for (const node of addedNodes) { + try { + if (node.matches(captchaOverlayQuery)) { + activate(); + } + } catch (_) {} + } + for (const node of removedNodes) { + try { + if (node.matches(captchaOverlayQuery)) { + deactivate(); + } + } catch (_) {} + } + } + }); + + captchaObserver.observe(document.documentElement, { + childList: true, + subtree: true, + }); +})(); diff --git a/mobile/android/android-components/components/feature/webcompat/src/main/assets/extensions/webcompat/lib/ua_overrides.js b/mobile/android/android-components/components/feature/webcompat/src/main/assets/extensions/webcompat/lib/ua_overrides.js index dd3bef2393e1..9c9a300b73c0 100644 --- a/mobile/android/android-components/components/feature/webcompat/src/main/assets/extensions/webcompat/lib/ua_overrides.js +++ b/mobile/android/android-components/components/feature/webcompat/src/main/assets/extensions/webcompat/lib/ua_overrides.js @@ -144,13 +144,14 @@ class UAOverrides { async registerUAOverrides() { const platformMatches = ["all"]; - let platformInfo = await browser.runtime.getPlatformInfo(); - platformMatches.push(platformInfo.os == "android" ? "android" : "desktop"); + const { os } = await browser.runtime.getPlatformInfo(); + platformMatches.push(os); + platformMatches.push(os == "android" ? "android" : "desktop"); for (const override of this._availableOverrides) { if (platformMatches.includes(override.platform)) { override.availableOnPlatform = true; - override.currentPlatform = platformInfo.os; + override.currentPlatform = os; // If there is a specific about:config preference governing // this override, monitor its state. diff --git a/mobile/android/android-components/components/feature/webcompat/src/main/assets/extensions/webcompat/manifest.json b/mobile/android/android-components/components/feature/webcompat/src/main/assets/extensions/webcompat/manifest.json index 6a0bed76e051..8d72b0f8e4e7 100644 --- a/mobile/android/android-components/components/feature/webcompat/src/main/assets/extensions/webcompat/manifest.json +++ b/mobile/android/android-components/components/feature/webcompat/src/main/assets/extensions/webcompat/manifest.json @@ -2,7 +2,7 @@ "manifest_version": 2, "name": "Web Compatibility Interventions", "description": "Urgent post-release fixes for web compatibility.", - "version": "128.5.0", + "version": "133.2.0", "browser_specific_settings": { "gecko": { "id": "webcompat@mozilla.org", @@ -120,6 +120,7 @@ "shims/facebook-sdk.js", "shims/facebook.svg", "shims/fastclick.js", + "shims/figshare.js", "shims/firebase.js", "shims/google-ads.js", "shims/google-analytics-and-tag-manager.js", diff --git a/mobile/android/android-components/components/feature/webcompat/src/main/assets/extensions/webcompat/shims/figshare.js b/mobile/android/android-components/components/feature/webcompat/src/main/assets/extensions/webcompat/shims/figshare.js new file mode 100644 index 000000000000..4f7bb0058fd8 --- /dev/null +++ b/mobile/android/android-components/components/feature/webcompat/src/main/assets/extensions/webcompat/shims/figshare.js @@ -0,0 +1,82 @@ +/* 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 1895990 - figshare login broken with dFPI enabled + * + * The websites that use figshare for login require unpartitioned third-party + * cookie access for https://figshare.com. The figshare login process sets a + * third-party cookie for https://figshare.com, which is used as an proof of + * authentication on redirect back to the main site. This shim adds a request + * for storage access for https://figshare.com when the user tries to log in. + */ + +// Third-party origin we need to request storage access for. +const STORAGE_ACCESS_ORIGIN = "https://figshare.com"; + +console.warn( + `When logging in, Firefox calls the Storage Access API on behalf of the site. See https://bugzilla.mozilla.org/show_bug.cgi?id=1895990 for details.` +); + +document.documentElement.addEventListener( + "click", + e => { + const { target, isTrusted } = e; + if (!isTrusted) { + return; + } + + // If the user clicks the login link, we need to request storage access + // for https://figshare.com. + const link = target.closest(`a[href^="https://login.figshare.com"]`); + if (!link) { + return; + } + + console.warn( + "Calling the Storage Access API on behalf of " + STORAGE_ACCESS_ORIGIN + ); + + e.stopPropagation(); + e.preventDefault(); + document.requestStorageAccessForOrigin(STORAGE_ACCESS_ORIGIN).then(() => { + link.click(); + }); + }, + true +); + +function watchFirefoxNotificationDialogAndHide() { + const observer = new MutationObserver((mutations, obs) => { + const element = document.querySelector( + "div[data-alerts-channel='firefox-notifications']" + ); + if (element) { + element.style.display = "none"; + obs.disconnect(); // Stop observing once we've found and hidden the element + } + }); + + // Start observing the document. + observer.observe(document.body, { + childList: true, + subtree: true, + }); +} + +// Hide the Firefox error notification +const notificationElement = document.querySelector( + "div[data-alerts-channel='firefox-notifications']" +); +if (notificationElement) { + notificationElement.style.display = "none"; +} else { + // Add a listener to watch for the Firefox notification element to load. + window.addEventListener( + "DOMContentLoaded", + watchFirefoxNotificationDialogAndHide + ); +} diff --git a/testing/webcompat/client.py b/testing/webcompat/client.py index 88208e550700..4481c8c1f96e 100644 --- a/testing/webcompat/client.py +++ b/testing/webcompat/client.py @@ -5,9 +5,12 @@ import asyncio import contextlib import time +from base64 import b64decode +from io import BytesIO from urllib.parse import quote import webdriver +from PIL import Image from webdriver.bidi.modules.script import ContextTarget @@ -324,7 +327,7 @@ class Client: ) async def await_text(self, text, **kwargs): - xpath = f"//*[contains(text(),'{text}')]" + xpath = f"//*[text()[contains(.,'{text}')]]" return await self.await_xpath(self, xpath, **kwargs) async def await_xpath( @@ -567,8 +570,8 @@ class Client: def find_text(self, text, is_displayed=None, **kwargs): try: - ele = self.find_xpath(f"//*[contains(text(),'{text}')]", **kwargs) - return self._do_is_displayed_check(ele, is_displayed) + e = self.find_xpath(f"//*[text()[contains(.,'{text}')]]", **kwargs) + return self._do_is_displayed_check(e, is_displayed) except webdriver.error.NoSuchElementException: return None @@ -757,3 +760,12 @@ class Client: """, args=[element], ) + + def is_one_solid_color(self, element, max_fuzz=8): + # max_fuzz is needed as screenshots can have slight color bleeding/fringing + shotb64 = element.screenshot() + shot = Image.open(BytesIO(b64decode(shotb64))).convert("RGB") + for min, max in shot.getextrema(): + if max - min > max_fuzz: + return False + return True diff --git a/testing/webcompat/interventions/tests/test_1779908_play_google_com.py b/testing/webcompat/interventions/tests/test_1779908_play_google_com.py new file mode 100644 index 000000000000..dd0da511cc3f --- /dev/null +++ b/testing/webcompat/interventions/tests/test_1779908_play_google_com.py @@ -0,0 +1,31 @@ +import pytest + +URL = "https://play.google.com/store/games" +TOP_BAR_CSS = ".aoJE7e" + + +async def top_bar_has_extra_scrollbar(client): + await client.navigate(URL) + top_bar = client.await_css(TOP_BAR_CSS) + return client.execute_script( + """ + const top_bar = arguments[0]; + const top_bar_item = top_bar.firstElementChild; + return top_bar.getBoundingClientRect().height > top_bar_item.getBoundingClientRect().height; + """, + top_bar, + ) + + +@pytest.mark.skip_platforms("android", "mac") +@pytest.mark.asyncio +@pytest.mark.with_interventions +async def test_enabled(client): + assert not await top_bar_has_extra_scrollbar(client) + + +@pytest.mark.skip_platforms("android", "mac") +@pytest.mark.asyncio +@pytest.mark.without_interventions +async def test_disabled(client): + assert await top_bar_has_extra_scrollbar(client) diff --git a/testing/webcompat/interventions/tests/test_1836872_docs_google_com.py b/testing/webcompat/interventions/tests/test_1836872_docs_google_com.py new file mode 100644 index 000000000000..8491f7541261 --- /dev/null +++ b/testing/webcompat/interventions/tests/test_1836872_docs_google_com.py @@ -0,0 +1,67 @@ +import pytest + +URL = "https://docs.google.com/document/d/1MUJpu1E-wR1Gq-a8csdzXbOXf4mSzNuMQGxoPPBqK1w/edit" + +FONT_BUTTON_CSS = "#docs-font-family .goog-toolbar-menu-button-inner-box" +FONT_MENU_WITH_SUBMENU_CSS = ( + ".goog-menu-vertical.docs-fontmenu .docs-submenuitem:has(.goog-submenu-arrow)" +) + + +async def are_font_submenus_accessible(client): + await client.navigate(URL) + + # wait for the submenus to be ready (added to the DOM) + client.await_css(FONT_MENU_WITH_SUBMENU_CSS) + + # open a submenu + client.await_css(FONT_BUTTON_CSS, is_displayed=True).click() + menuitem = client.await_css(FONT_MENU_WITH_SUBMENU_CSS, is_displayed=True) + font = client.execute_script( + """ + const [menuitem] = arguments; + + // get the name of the font, which helps us know which panel to wait for docs to create + const font = menuitem.querySelector("span[style]").style.fontFamily.replace("--Menu", ""); + + // trigger a mouseover on the menu item so docs opens the panel + menuitem.dispatchEvent(new MouseEvent("mouseover", { + bubbles: true, + cancelable: true, + view: window, + })); + + return font; + """, + menuitem, + ) + + # wait for the on-hover popup to actually be created and displayed + popup = client.await_xpath( + "//*[contains(@style, '{}')]".format(font), is_displayed=True + ) + assert popup + + return client.execute_script( + """ + const menuitem_arrow = arguments[0].querySelector(".goog-submenu-arrow"); + const popup = arguments[1].closest(".goog-menu.goog-menu-vertical"); + return popup.getBoundingClientRect().left < menuitem_arrow.getBoundingClientRect().right; + """, + menuitem, + popup, + ) + + +@pytest.mark.skip_platforms("android") +@pytest.mark.asyncio +@pytest.mark.with_interventions +async def test_enabled(client): + assert await are_font_submenus_accessible(client) + + +@pytest.mark.skip_platforms("android") +@pytest.mark.asyncio +@pytest.mark.without_interventions +async def test_disabled(client): + assert not await are_font_submenus_accessible(client) diff --git a/testing/webcompat/interventions/tests/test_1856915_login_yahoo_com.py b/testing/webcompat/interventions/tests/test_1856915_login_yahoo_com.py new file mode 100644 index 000000000000..23fc38ce1034 --- /dev/null +++ b/testing/webcompat/interventions/tests/test_1856915_login_yahoo_com.py @@ -0,0 +1,44 @@ +import pytest +from webdriver.error import NoSuchElementException + +URL = "https://login.yahoo.com/" +USERNAME_CSS = "#login-username" +SIGNIN_CSS = "#login-signin" +TOGGLE_CSS = "#password-toggle-button" +RECAPTCHA_CSS = "#recaptcha-challenge" + + +async def is_password_reveal_toggle_fully_visible(client): + await client.navigate(URL) + client.await_css(USERNAME_CSS).send_keys("webcompat") + client.await_css(SIGNIN_CSS).click() + client.await_css(RECAPTCHA_CSS, is_displayed=True) + print("\a") # beep to let the user know to do the reCAPTCHA + try: + toggle = client.await_css(TOGGLE_CSS, timeout=60) + except NoSuchElementException: + pytest.xfail( + "Timed out waiting for reCAPTCHA to be completed. Please try again." + ) + return False + return client.execute_script( + """ + const toggle = arguments[0].getBoundingClientRect(); + return toggle.width >= 16; + """, + toggle, + ) + + +@pytest.mark.only_platforms("android") +@pytest.mark.asyncio +@pytest.mark.with_interventions +async def test_enabled(client): + assert await is_password_reveal_toggle_fully_visible(client) + + +@pytest.mark.only_platforms("android") +@pytest.mark.asyncio +@pytest.mark.without_interventions +async def test_disabled(client): + assert not await is_password_reveal_toggle_fully_visible(client) diff --git a/testing/webcompat/interventions/tests/test_1886616_www_six-group_com.py b/testing/webcompat/interventions/tests/test_1886616_www_six-group_com.py new file mode 100644 index 000000000000..992c69ea67fb --- /dev/null +++ b/testing/webcompat/interventions/tests/test_1886616_www_six-group_com.py @@ -0,0 +1,41 @@ +import pytest +from webdriver.error import NoSuchElementException + +URL = "https://www.six-group.com/en/market-data/etf/etf-explorer.html" +COOKIES_CSS = "#onetrust-consent-sdk" +SELECT_CSS = "select[name='Dropdown']:has(option[value='active'])" + + +async def select_value_is_visible(client): + try: + cookies = client.await_css(COOKIES_CSS, is_displayed=True, timeout=5) + client.remove_element(cookies) + except NoSuchElementException: + pass + + select = client.await_css(SELECT_CSS, is_displayed=True) + assert select + # remove the border and background from the select, so only the text + # should influence the screenshot. + client.execute_script( + """ + arguments[0].style.border = 'none'; + arguments[0].style.background = '#fff'; + """, + select, + ) + return not client.is_one_solid_color(select) + + +@pytest.mark.asyncio +@pytest.mark.with_interventions +async def test_enabled(client): + await client.navigate(URL) + assert await select_value_is_visible(client) + + +@pytest.mark.asyncio +@pytest.mark.without_interventions +async def test_disabled(client): + await client.navigate(URL) + assert not await select_value_is_visible(client) diff --git a/testing/webcompat/interventions/tests/test_1896349_vivaldi_com.py b/testing/webcompat/interventions/tests/test_1896349_vivaldi_com.py new file mode 100644 index 000000000000..6bc6aa72e46b --- /dev/null +++ b/testing/webcompat/interventions/tests/test_1896349_vivaldi_com.py @@ -0,0 +1,40 @@ +import pytest + +URL = "https://vivaldi.com/blog/technology/vivaldi-wont-allow-a-machine-to-lie-to-you/" +TEXT_CSS = "article header h1" + + +async def is_selection_different(client): + text = client.await_css(TEXT_CSS, is_displayed=True) + assert text + + before = text.screenshot() + + client.execute_script( + """ + const text = arguments[0]; + const range = document.createRange(); + range.setStart(text, 0); + range.setEnd(text, 1); + const selection = window.getSelection(); + selection.removeAllRanges(); + selection.addRange(range); + """, + text, + ) + + return before != text.screenshot() + + +@pytest.mark.asyncio +@pytest.mark.with_interventions +async def test_enabled(client): + await client.navigate(URL) + assert await is_selection_different(client) + + +@pytest.mark.asyncio +@pytest.mark.without_interventions +async def test_disabled(client): + await client.navigate(URL) + assert not await is_selection_different(client) diff --git a/testing/webcompat/interventions/tests/test_1898952_digits_t-mobile_com.py b/testing/webcompat/interventions/tests/test_1898952_digits_t-mobile_com.py new file mode 100644 index 000000000000..c6ec576964b9 --- /dev/null +++ b/testing/webcompat/interventions/tests/test_1898952_digits_t-mobile_com.py @@ -0,0 +1,23 @@ +import pytest + +URL = "https://digits.t-mobile.com/" +BLOCKED_CSS = "#incompatible" +NOT_BLOCKED_CSS = "#compatible" + + +@pytest.mark.skip_platforms("android") +@pytest.mark.asyncio +@pytest.mark.with_interventions +async def test_enabled(client): + await client.navigate(URL) + assert client.await_css(NOT_BLOCKED_CSS) + assert not client.find_css(BLOCKED_CSS) + + +@pytest.mark.skip_platforms("android") +@pytest.mark.asyncio +@pytest.mark.without_interventions +async def test_disabled(client): + await client.navigate(URL) + assert client.await_css(BLOCKED_CSS) + assert not client.find_css(NOT_BLOCKED_CSS) diff --git a/testing/webcompat/interventions/tests/test_1899937_plus_nhk_jp.py b/testing/webcompat/interventions/tests/test_1899937_plus_nhk_jp.py new file mode 100644 index 000000000000..892ee6c0622e --- /dev/null +++ b/testing/webcompat/interventions/tests/test_1899937_plus_nhk_jp.py @@ -0,0 +1,36 @@ +import pytest + +URL = "https://plus.nhk.jp/" +UNSUPPORTED_CSS = ".firefox_not_supported" +DENIED_TEXT = "This webpage is not available in your area" + + +async def check_site(client, should_pass): + await client.navigate(URL, wait="load") + + denied, unsupported = client.await_first_element_of( + [ + client.text(DENIED_TEXT), + client.css(UNSUPPORTED_CSS), + ] + ) + + if denied: + pytest.skip("Region-locked, cannot test. Try using a VPN set to Japan.") + return + + assert (should_pass and not client.is_displayed(unsupported)) or ( + not should_pass and client.is_displayed(unsupported) + ) + + +@pytest.mark.asyncio +@pytest.mark.with_interventions +async def test_enabled(client): + await check_site(client, should_pass=True) + + +@pytest.mark.asyncio +@pytest.mark.without_interventions +async def test_disabled(client): + await check_site(client, should_pass=False) diff --git a/testing/webcompat/requirements.txt b/testing/webcompat/requirements.txt index 1e5f90af3cd7..c3e0c511d16a 100644 --- a/testing/webcompat/requirements.txt +++ b/testing/webcompat/requirements.txt @@ -1,3 +1,4 @@ asyncio==3.4.3 +pillow==10.3.0 pytest-asyncio==0.16.0 urllib3==1.26