Bug 1925270 - uplift webcompat interventions for v133.2.0 to ESR 128; r=denschub a=RyanVM

Differential Revision: https://phabricator.services.mozilla.com/D226038
This commit is contained in:
Thomas Wisniewski 2024-10-18 16:31:00 +00:00
parent 7d979155b4
commit 88ec901b2c
56 changed files with 2348 additions and 121 deletions

View file

@ -290,6 +290,8 @@ const AVAILABLE_INJECTIONS = [
"*://www.facebook.com/*", // Bug 1739489 "*://www.facebook.com/*", // Bug 1739489
"*://twitter.com/*", // Bug 1776229 "*://twitter.com/*", // Bug 1776229
"*://mobile.twitter.com/*", // Bug 1776229 "*://mobile.twitter.com/*", // Bug 1776229
"*://x.com/*", // Bug 1776229
"*://mobile.x.com/*", // Bug 1776229
"*://*.reddit.com/*", // Bug 1829755 "*://*.reddit.com/*", // Bug 1829755
], ],
js: [ js: [
@ -585,6 +587,7 @@ const AVAILABLE_INJECTIONS = [
"*://*.lafoodbank.org/*", // 127006 "*://*.lafoodbank.org/*", // 127006
"*://rutamayacoffee.com/*", // 129353 "*://rutamayacoffee.com/*", // 129353
"*://ottoandspike.com.au/*", // bugzilla 1644602 "*://ottoandspike.com.au/*", // bugzilla 1644602
"*://give.umrelief.org/give/*", // bugzilla 1916407
], ],
js: [ 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", id: "bug1884842",
platform: "android", platform: "android",
@ -1059,15 +1048,108 @@ const AVAILABLE_INJECTIONS = [
}, },
}, },
{ {
id: "1882040", id: "1922175",
platform: "android", platform: "all",
domain: "YouTube Shorts", domain: "app.livingsecurity.com",
bug: "1882040", bug: "1922175",
contentScripts: { 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: [ 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, 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; module.exports = AVAILABLE_INJECTIONS;

View file

@ -379,6 +379,27 @@ const AVAILABLE_SHIMS = [
], ],
onlyIfBlockedByETP: true, 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", id: "GoogleAnalyticsAndTagManager",
platform: "all", platform: "all",

View file

@ -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; module.exports = AVAILABLE_UA_OVERRIDES;

View file

@ -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;
}

View file

@ -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;
}

View file

@ -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;
}

View file

@ -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: "";
}

View file

@ -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;
}

View file

@ -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;
}

View file

@ -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;
}

View file

@ -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;
}

View file

@ -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;
}

View file

@ -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;
}

View file

@ -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;
}
}

View file

@ -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),
});
})();

View file

@ -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),
});
})();

View file

@ -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),
});

View file

@ -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),
});
}

View file

@ -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),
});

View file

@ -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,
});
})();

View file

@ -144,13 +144,14 @@ class UAOverrides {
async registerUAOverrides() { async registerUAOverrides() {
const platformMatches = ["all"]; const platformMatches = ["all"];
let platformInfo = await browser.runtime.getPlatformInfo(); const { os } = await browser.runtime.getPlatformInfo();
platformMatches.push(platformInfo.os == "android" ? "android" : "desktop"); platformMatches.push(os);
platformMatches.push(os == "android" ? "android" : "desktop");
for (const override of this._availableOverrides) { for (const override of this._availableOverrides) {
if (platformMatches.includes(override.platform)) { if (platformMatches.includes(override.platform)) {
override.availableOnPlatform = true; override.availableOnPlatform = true;
override.currentPlatform = platformInfo.os; override.currentPlatform = os;
// If there is a specific about:config preference governing // If there is a specific about:config preference governing
// this override, monitor its state. // this override, monitor its state.

View file

@ -2,7 +2,7 @@
"manifest_version": 2, "manifest_version": 2,
"name": "Web Compatibility Interventions", "name": "Web Compatibility Interventions",
"description": "Urgent post-release fixes for web compatibility.", "description": "Urgent post-release fixes for web compatibility.",
"version": "128.5.0", "version": "133.2.0",
"browser_specific_settings": { "browser_specific_settings": {
"gecko": { "gecko": {
"id": "webcompat@mozilla.org", "id": "webcompat@mozilla.org",
@ -120,6 +120,7 @@
"shims/facebook-sdk.js", "shims/facebook-sdk.js",
"shims/facebook.svg", "shims/facebook.svg",
"shims/fastclick.js", "shims/fastclick.js",
"shims/figshare.js",
"shims/firebase.js", "shims/firebase.js",
"shims/google-ads.js", "shims/google-ads.js",
"shims/google-analytics-and-tag-manager.js", "shims/google-analytics-and-tag-manager.js",

View file

@ -56,6 +56,7 @@ FINAL_TARGET_FILES.features["webcompat@mozilla.org"]["injections"]["css"] += [
"injections/css/bug1765947-veniceincoming.com-left-fix.css", "injections/css/bug1765947-veniceincoming.com-left-fix.css",
"injections/css/bug1770962-coldwellbankerhomes.com-image-height.css", "injections/css/bug1770962-coldwellbankerhomes.com-image-height.css",
"injections/css/bug1774490-rainews.it-gallery-fix.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/bug1784141-aveeno.com-acuvue.com-unsupported.css",
"injections/css/bug1784199-entrata-platform-unsupported.css", "injections/css/bug1784199-entrata-platform-unsupported.css",
"injections/css/bug1819678-nppes.cms.hhs.gov-unsupported-banner.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/bug1830813-page.onstove.com-hide-unsupported.css",
"injections/css/bug1836103-autostar-novoross.ru-make-map-taller.css", "injections/css/bug1836103-autostar-novoross.ru-make-map-taller.css",
"injections/css/bug1836105-cnn.com-fix-blank-pages-when-printing.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/bug1848711-vio.com-page-height.css",
"injections/css/bug1848713-cleanrider.com-slider.css", "injections/css/bug1848713-cleanrider.com-slider.css",
"injections/css/bug1848849-theaa.com-printing-mode-fix.css", "injections/css/bug1848849-theaa.com-printing-mode-fix.css",
"injections/css/bug1849388-kucharkaprodceru.cz-scroll-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/bug1868345-tvmovie.de-scroll-fix.css",
"injections/css/bug1877346-offerup.com-infinite-scroll-fix.css", "injections/css/bug1879879-developers.pinterest.com-list-alignment-fix.css",
"injections/css/bug1882040-disable-pull-to-refresh.css",
"injections/css/bug1884842-foodora.cz-height-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"] += [ 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/bug1830776-blueshieldca.com-unsupported.js",
"injections/js/bug1831007-nintendo-window-OnetrustActiveGroups.js", "injections/js/bug1831007-nintendo-window-OnetrustActiveGroups.js",
"injections/js/bug1836157-thai-masszazs-niceScroll-disable.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/bug1842437-www.youtube.com-performance-now-precision.js",
"injections/js/bug1849058-nicochannel.jp-picture-in-picture-shim.js", "injections/js/bug1849058-nicochannel.jp-picture-in-picture-shim.js",
"injections/js/bug1855014-eksiseyler.com.js", "injections/js/bug1855014-eksiseyler.com.js",
"injections/js/bug1855071-www.meteoam.it.js", "injections/js/bug1855071-www.meteoam.it.js",
"injections/js/bug1859617-installtrigger-removal-shim.js", "injections/js/bug1859617-installtrigger-removal-shim.js",
"injections/js/bug1864564-esri-transfrom-names-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/bug1896383-error-capturestacktrace-shim.js",
"injections/js/bug1897120-turnjs-zoom-fix.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"] += [ 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-sdk.js",
"shims/facebook.svg", "shims/facebook.svg",
"shims/fastclick.js", "shims/fastclick.js",
"shims/figshare.js",
"shims/firebase.js", "shims/firebase.js",
"shims/google-ads.js", "shims/google-ads.js",
"shims/google-analytics-and-tag-manager.js", "shims/google-analytics-and-tag-manager.js",

View file

@ -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
);
}

View file

@ -290,6 +290,8 @@ const AVAILABLE_INJECTIONS = [
"*://www.facebook.com/*", // Bug 1739489 "*://www.facebook.com/*", // Bug 1739489
"*://twitter.com/*", // Bug 1776229 "*://twitter.com/*", // Bug 1776229
"*://mobile.twitter.com/*", // Bug 1776229 "*://mobile.twitter.com/*", // Bug 1776229
"*://x.com/*", // Bug 1776229
"*://mobile.x.com/*", // Bug 1776229
"*://*.reddit.com/*", // Bug 1829755 "*://*.reddit.com/*", // Bug 1829755
], ],
js: [ js: [
@ -585,6 +587,7 @@ const AVAILABLE_INJECTIONS = [
"*://*.lafoodbank.org/*", // 127006 "*://*.lafoodbank.org/*", // 127006
"*://rutamayacoffee.com/*", // 129353 "*://rutamayacoffee.com/*", // 129353
"*://ottoandspike.com.au/*", // bugzilla 1644602 "*://ottoandspike.com.au/*", // bugzilla 1644602
"*://give.umrelief.org/give/*", // bugzilla 1916407
], ],
js: [ 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", id: "bug1884842",
platform: "android", platform: "android",
@ -1059,15 +1048,108 @@ const AVAILABLE_INJECTIONS = [
}, },
}, },
{ {
id: "1882040", id: "1922175",
platform: "android", platform: "all",
domain: "YouTube Shorts", domain: "app.livingsecurity.com",
bug: "1882040", bug: "1922175",
contentScripts: { 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: [ 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, 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; module.exports = AVAILABLE_INJECTIONS;

View file

@ -379,6 +379,27 @@ const AVAILABLE_SHIMS = [
], ],
onlyIfBlockedByETP: true, 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", id: "GoogleAnalyticsAndTagManager",
platform: "all", platform: "all",

View file

@ -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; module.exports = AVAILABLE_UA_OVERRIDES;

View file

@ -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;
}

View file

@ -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;
}

View file

@ -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;
}

View file

@ -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: "";
}

View file

@ -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;
}

View file

@ -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;
}

View file

@ -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;
}

View file

@ -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;
}

View file

@ -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;
}

View file

@ -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;
}

View file

@ -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;
}
}

View file

@ -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),
});
})();

View file

@ -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),
});
})();

View file

@ -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),
});

View file

@ -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),
});
}

View file

@ -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),
});

View file

@ -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,
});
})();

View file

@ -144,13 +144,14 @@ class UAOverrides {
async registerUAOverrides() { async registerUAOverrides() {
const platformMatches = ["all"]; const platformMatches = ["all"];
let platformInfo = await browser.runtime.getPlatformInfo(); const { os } = await browser.runtime.getPlatformInfo();
platformMatches.push(platformInfo.os == "android" ? "android" : "desktop"); platformMatches.push(os);
platformMatches.push(os == "android" ? "android" : "desktop");
for (const override of this._availableOverrides) { for (const override of this._availableOverrides) {
if (platformMatches.includes(override.platform)) { if (platformMatches.includes(override.platform)) {
override.availableOnPlatform = true; override.availableOnPlatform = true;
override.currentPlatform = platformInfo.os; override.currentPlatform = os;
// If there is a specific about:config preference governing // If there is a specific about:config preference governing
// this override, monitor its state. // this override, monitor its state.

View file

@ -2,7 +2,7 @@
"manifest_version": 2, "manifest_version": 2,
"name": "Web Compatibility Interventions", "name": "Web Compatibility Interventions",
"description": "Urgent post-release fixes for web compatibility.", "description": "Urgent post-release fixes for web compatibility.",
"version": "128.5.0", "version": "133.2.0",
"browser_specific_settings": { "browser_specific_settings": {
"gecko": { "gecko": {
"id": "webcompat@mozilla.org", "id": "webcompat@mozilla.org",
@ -120,6 +120,7 @@
"shims/facebook-sdk.js", "shims/facebook-sdk.js",
"shims/facebook.svg", "shims/facebook.svg",
"shims/fastclick.js", "shims/fastclick.js",
"shims/figshare.js",
"shims/firebase.js", "shims/firebase.js",
"shims/google-ads.js", "shims/google-ads.js",
"shims/google-analytics-and-tag-manager.js", "shims/google-analytics-and-tag-manager.js",

View file

@ -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
);
}

View file

@ -5,9 +5,12 @@
import asyncio import asyncio
import contextlib import contextlib
import time import time
from base64 import b64decode
from io import BytesIO
from urllib.parse import quote from urllib.parse import quote
import webdriver import webdriver
from PIL import Image
from webdriver.bidi.modules.script import ContextTarget from webdriver.bidi.modules.script import ContextTarget
@ -324,7 +327,7 @@ class Client:
) )
async def await_text(self, text, **kwargs): 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) return await self.await_xpath(self, xpath, **kwargs)
async def await_xpath( async def await_xpath(
@ -567,8 +570,8 @@ class Client:
def find_text(self, text, is_displayed=None, **kwargs): def find_text(self, text, is_displayed=None, **kwargs):
try: try:
ele = self.find_xpath(f"//*[contains(text(),'{text}')]", **kwargs) e = self.find_xpath(f"//*[text()[contains(.,'{text}')]]", **kwargs)
return self._do_is_displayed_check(ele, is_displayed) return self._do_is_displayed_check(e, is_displayed)
except webdriver.error.NoSuchElementException: except webdriver.error.NoSuchElementException:
return None return None
@ -757,3 +760,12 @@ class Client:
""", """,
args=[element], 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

View file

@ -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)

View file

@ -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)

View file

@ -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)

View file

@ -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)

View file

@ -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)

View file

@ -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)

View file

@ -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)

View file

@ -1,3 +1,4 @@
asyncio==3.4.3 asyncio==3.4.3
pillow==10.3.0
pytest-asyncio==0.16.0 pytest-asyncio==0.16.0
urllib3==1.26 urllib3==1.26