diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 14:29:10 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 14:29:10 +0000 |
commit | 2aa4a82499d4becd2284cdb482213d541b8804dd (patch) | |
tree | b80bf8bf13c3766139fbacc530efd0dd9d54394c /browser/extensions/webcompat/injections | |
parent | Initial commit. (diff) | |
download | firefox-upstream.tar.xz firefox-upstream.zip |
Adding upstream version 86.0.1.upstream/86.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'browser/extensions/webcompat/injections')
29 files changed, 612 insertions, 0 deletions
diff --git a/browser/extensions/webcompat/injections/css/bug0000000-testbed-css-injection.css b/browser/extensions/webcompat/injections/css/bug0000000-testbed-css-injection.css new file mode 100644 index 0000000000..1e82ee9722 --- /dev/null +++ b/browser/extensions/webcompat/injections/css/bug0000000-testbed-css-injection.css @@ -0,0 +1,3 @@ +#css-injection.red { + background-color: #0f0; +} diff --git a/browser/extensions/webcompat/injections/css/bug1561371-mail.google.com-allow-horizontal-scrolling.css b/browser/extensions/webcompat/injections/css/bug1561371-mail.google.com-allow-horizontal-scrolling.css new file mode 100644 index 0000000000..15a7fe1484 --- /dev/null +++ b/browser/extensions/webcompat/injections/css/bug1561371-mail.google.com-allow-horizontal-scrolling.css @@ -0,0 +1,12 @@ +/** + * mail.google.com - The HTML email view does not allow horizontal scrolling + * on Firefox mobile due to a missing CSS rule which is only served to Chrome. + * Bug #1561371 - https://bugzilla.mozilla.org/show_bug.cgi?id=1561371 + * + * HTML emails may sometimes contain content that does not wrap, yet the + * CSS served to Firefox Mobile does not permit scrolling horizontally. + * To prevent this UX frustration, we enable horizontal scrolling. + */ +body > #views { + overflow: auto; +} diff --git a/browser/extensions/webcompat/injections/css/bug1570119-teamcoco.com-scrollbar-width.css b/browser/extensions/webcompat/injections/css/bug1570119-teamcoco.com-scrollbar-width.css new file mode 100644 index 0000000000..7a6c2c07c2 --- /dev/null +++ b/browser/extensions/webcompat/injections/css/bug1570119-teamcoco.com-scrollbar-width.css @@ -0,0 +1,11 @@ +/** + * teamcoco.com - a scrollbar at the top covering navigation menu + * Bug #1570119 - https://bugzilla.mozilla.org/show_bug.cgi?id=1570119 + * + * The scrollbar is covering navigation items making them unusable. + * There are ::-webkit-scrollbar css rules already applied to the scrollbar, + * hiding it in Chrome. Adding the scrollbar-width: none fixes the issue in Firefox. + */ +.css-bdnz85 { + scrollbar-width: none; +} diff --git a/browser/extensions/webcompat/injections/css/bug1570328-developer-apple.com-transform-scale.css b/browser/extensions/webcompat/injections/css/bug1570328-developer-apple.com-transform-scale.css new file mode 100644 index 0000000000..2ffd45a361 --- /dev/null +++ b/browser/extensions/webcompat/injections/css/bug1570328-developer-apple.com-transform-scale.css @@ -0,0 +1,17 @@ +/** + * developer.apple.com - content of the page is shifted to the left + * Bug #1570328 - https://bugzilla.mozilla.org/show_bug.cgi?id=1570328 + * WebCompat issue #4070 - https://webcompat.com/issues/4070 + * + * The site is relying on zoom property which is not supported by Mozilla, + * see https://bugzilla.mozilla.org/show_bug.cgi?id=390936. Adding a combination + * of transform: scale(1.4), transform-origin and width fixes the issue + */ +@media only screen and (min-device-width: 320px) and (max-device-width: 980px), + (min-device-width: 1024px) and (max-device-width: 1024px) and (min-device-height: 1366px) and (max-device-height: 1366px) and (min-width: 320px) and (max-width: 980px) { + #tocContainer { + transform-origin: 0 0; + transform: scale(1.4); + width: 71.4%; + } +} diff --git a/browser/extensions/webcompat/injections/css/bug1575000-apply.lloydsbank.co.uk-radio-buttons-fix.css b/browser/extensions/webcompat/injections/css/bug1575000-apply.lloydsbank.co.uk-radio-buttons-fix.css new file mode 100644 index 0000000000..d6c7e82e26 --- /dev/null +++ b/browser/extensions/webcompat/injections/css/bug1575000-apply.lloydsbank.co.uk-radio-buttons-fix.css @@ -0,0 +1,11 @@ +/** + * apply.lloydsbank.co.uk - radio buttons are misplaced + * Bug #1575000 - https://bugzilla.mozilla.org/show_bug.cgi?id=1575000 + * WebCompat issue #34969 - https://webcompat.com/issues/34969 + * + * Radio buttons are displaced to the left due to positioning issue of ::before + * pseudo element, adding position relative to it's parent fixes the issue. + */ +.radio-content-field .radio.inline label span.text { + position: relative; +} diff --git a/browser/extensions/webcompat/injections/css/bug1605611-maps.google.com-directions-time.css b/browser/extensions/webcompat/injections/css/bug1605611-maps.google.com-directions-time.css new file mode 100644 index 0000000000..c0f4fae1f5 --- /dev/null +++ b/browser/extensions/webcompat/injections/css/bug1605611-maps.google.com-directions-time.css @@ -0,0 +1,24 @@ +/** + * Bug 1605611 - Cannot change Departure/arrival dates in Google Maps on Android + * + * This is step 3 - see injections/js/bug1605611-maps.google.com-directions-time.js. + * Google Maps calls .click() on a datetime-local input element, with the intent + * to show the native date picker. But the native date picker does not appear, + * because that only happens when a user initiated the click. + * To fix the problem of the date picker not appearing in Google Maps, alter the + * styles of the datetime-local input element, to be rendered on top of the + * usual UI (i.e. the icon and date/time text). This allows the user to summon + * the native date picker when they tap on the relevant UI in Google Maps. + */ + +.ml-route-options-picker-content-button + > #ml-route-options-time-selector-time-input { + z-index: 1; /* overrides -5000, to show on top of the icon AND the rendered date */ + opacity: 0; /* let the input element be fully transparent */ + width: 100vw; /* render over the rendered date from Maps' dialog */ + /* position this (absolute) element to fully cover the parent container */ + left: 0; + bottom: 0; + top: 0; + height: 100%; +} diff --git a/browser/extensions/webcompat/injections/css/bug1610016-gaana.com-input-position-fix.css b/browser/extensions/webcompat/injections/css/bug1610016-gaana.com-input-position-fix.css new file mode 100644 index 0000000000..258841fdda --- /dev/null +++ b/browser/extensions/webcompat/injections/css/bug1610016-gaana.com-input-position-fix.css @@ -0,0 +1,13 @@ +/** + * gaana.com - unable to accept T&C and Privacy Policy + * Bug #1610016 - https://bugzilla.mozilla.org/show_bug.cgi?id=1610016 + * WebCompat issue #29886 - https://webcompat.com/issues/29886 + * + * Unable to click on checkboxes due to input element floating to the right. + * More info https://bugzilla.mozilla.org/show_bug.cgi?id=997189. Adding explicit + * positioning to the input fixes the issue + */ +.agree_btns input { + top: 0; + left: 0; +} diff --git a/browser/extensions/webcompat/injections/css/bug1610344-directv.com.co-hide-unsupported-message.css b/browser/extensions/webcompat/injections/css/bug1610344-directv.com.co-hide-unsupported-message.css new file mode 100644 index 0000000000..80f94aa306 --- /dev/null +++ b/browser/extensions/webcompat/injections/css/bug1610344-directv.com.co-hide-unsupported-message.css @@ -0,0 +1,13 @@ +/** + * directv.com.co - Browser is not supported message + * Bug #1610344 - https://bugzilla.mozilla.org/show_bug.cgi?id=1610344 + * WebCompat issue #41822 - https://webcompat.com/issues/41822 + * + * directv.com.co is showing a "This browser is not supported" message in + * Firefox. Our tests indicated that everything is working just fine, and our + * previous contact attempts have not been successful. This intervention + * hides the large red unsupported banner. + */ +.browser-compatible.compatible.incompatible { + display: none; +} diff --git a/browser/extensions/webcompat/injections/css/bug1644830-missingmail.usps.com-checkboxes-not-visible.css b/browser/extensions/webcompat/injections/css/bug1644830-missingmail.usps.com-checkboxes-not-visible.css new file mode 100644 index 0000000000..191985b691 --- /dev/null +++ b/browser/extensions/webcompat/injections/css/bug1644830-missingmail.usps.com-checkboxes-not-visible.css @@ -0,0 +1,13 @@ +/** + * missingmail.usps.com - Unable to mark the check-boxes from "Disclaimer and + * Terms and Conditions" section + * Bug #1644830 - https://bugzilla.mozilla.org/show_bug.cgi?id=1644830 + * WebCompat issue #53950 - https://webcompat.com/issues/53950 + * + * missingmail.usps.com runs into a case of bug 997189, where an absolutely + * positioned inline-block element with floating siblings is shifter to the + * right, and thus invisible. + */ +.mrc-custom-checkbox-container input { + margin-left: -3rem; +} diff --git a/browser/extensions/webcompat/injections/css/bug1645064-s-kanava.fi-invisible-charts.css b/browser/extensions/webcompat/injections/css/bug1645064-s-kanava.fi-invisible-charts.css new file mode 100644 index 0000000000..d5c348ad25 --- /dev/null +++ b/browser/extensions/webcompat/injections/css/bug1645064-s-kanava.fi-invisible-charts.css @@ -0,0 +1,12 @@ +/** + * s-kanava.fi - The tables carousel is missing + * Bug #1645064 - https://bugzilla.mozilla.org/show_bug.cgi?id=1645064 + * WebCompat issue #53584 - https://webcompat.com/issues/53584 + * + * This site runs into a known Flex issue, see bug 1469649. However, the issue + * is easy to workaround in this case by explicitly specifying the width of + * the flex container. + */ +.carousel .slider-wrapper.axis-horizontal .slider .slide { + max-width: 100%; +} diff --git a/browser/extensions/webcompat/injections/css/bug1651917-teletrader.com.body-transform-origin.css b/browser/extensions/webcompat/injections/css/bug1651917-teletrader.com.body-transform-origin.css new file mode 100644 index 0000000000..e7a44a93d7 --- /dev/null +++ b/browser/extensions/webcompat/injections/css/bug1651917-teletrader.com.body-transform-origin.css @@ -0,0 +1,14 @@ +/** + * teletrader.com - content is shifted down and right + * Bug #1651917 - https://bugzilla.mozilla.org/show_bug.cgi?id=1651917 + * WebCompat issue #55217 - https://webcompat.com/issues/55217 + * + * The content is shifted down and right, because they use webkit prefixes + * for scaling and redefining the origin. Firefox doesn't support + * -webkit-transform-origin-x/y + * This is the object of https://bugzilla.mozilla.org/show_bug.cgi?id=1584881 + * Adding transform-origin: 0 0; to body fixes the issue + */ +body { + transform-origin: 0 0; +} diff --git a/browser/extensions/webcompat/injections/css/bug1653075-livescience.com-scrollbar-width.css b/browser/extensions/webcompat/injections/css/bug1653075-livescience.com-scrollbar-width.css new file mode 100644 index 0000000000..3d7a069676 --- /dev/null +++ b/browser/extensions/webcompat/injections/css/bug1653075-livescience.com-scrollbar-width.css @@ -0,0 +1,14 @@ +/** + * livescience.com - a scrollbar covering navigation menu + * Bug #1653075 - https://bugzilla.mozilla.org/show_bug.cgi?id=1653075 + * + * The scrollbar is covering navigation items and that makes them half hidden. + * There are some ::-webkit-scrollbar css rules applied to the scrollbar, + * making it thinner. Adding similar rules for Firefox fixes the issue. + */ +@media screen and (max-width: 900px) { + .trending-wrapper .trending-items { + scrollbar-width: thin; + scrollbar-color: #f9ae3b #f5f5f5; + } +} diff --git a/browser/extensions/webcompat/injections/css/bug1654865-sports.ndtv.com-float-fix.css b/browser/extensions/webcompat/injections/css/bug1654865-sports.ndtv.com-float-fix.css new file mode 100644 index 0000000000..f9edefb735 --- /dev/null +++ b/browser/extensions/webcompat/injections/css/bug1654865-sports.ndtv.com-float-fix.css @@ -0,0 +1,13 @@ +/** + * sports.ndtv.com - content is of the articles is not displayed + * Bug #1654865 - https://bugzilla.mozilla.org/show_bug.cgi?id=1654865 + * WebCompat issue #55377 - https://webcompat.com/issues/55377 + * + * The content has width:0, due to uncleared float and negative margin combination, + * which is https://bugzilla.mozilla.org/show_bug.cgi?id=1400958 + * Adding clear: both; to the element located above the affected div + * the fixes the issue + */ +.t-brd { + clear: both; +} diff --git a/browser/extensions/webcompat/injections/css/bug1654877-preev.com-moz-appearance-fix.css b/browser/extensions/webcompat/injections/css/bug1654877-preev.com-moz-appearance-fix.css new file mode 100644 index 0000000000..111ec522df --- /dev/null +++ b/browser/extensions/webcompat/injections/css/bug1654877-preev.com-moz-appearance-fix.css @@ -0,0 +1,15 @@ +/** + * preev.com - typed numbers are not fully visible + * Bug #1654877 - https://bugzilla.mozilla.org/show_bug.cgi?id=1654877 + * WebCompat issue #55099 - https://webcompat.com/issues/55099 + * + * It's hard to see the entered number because the spin button is + * taking too much space. While there is -moz-appearance: textfield, + * -webkit-appearance: none; underneath supersedes it, + * leaving the spin button visible. Adding -moz-appearance: textfield; + * as a separate rule fixes the issue + */ +input[type="number"], +input[type="text"] { + -moz-appearance: textfield; +} diff --git a/browser/extensions/webcompat/injections/css/bug1654907-reactine.ca-hide-unsupported.css b/browser/extensions/webcompat/injections/css/bug1654907-reactine.ca-hide-unsupported.css new file mode 100644 index 0000000000..2893e873ed --- /dev/null +++ b/browser/extensions/webcompat/injections/css/bug1654907-reactine.ca-hide-unsupported.css @@ -0,0 +1,12 @@ +/** + * reactine.ca - Unsupported browser message + * Bug #1654907 - https://bugzilla.mozilla.org/show_bug.cgi?id=1654907 + * WebCompat issue #55481 - https://webcompat.com/issues/55481 + * + * reactine.ca is showing "Sorry this browser is not supported." + * message if Firefox for Android based on UA detection. Site seems + * to be working fine, so this intervention is to hide this message + */ +#browser-alert { + display: none !important; +} diff --git a/browser/extensions/webcompat/injections/css/bug1655049-dev.to-unclickable-button-fix.css b/browser/extensions/webcompat/injections/css/bug1655049-dev.to-unclickable-button-fix.css new file mode 100644 index 0000000000..2e40f14955 --- /dev/null +++ b/browser/extensions/webcompat/injections/css/bug1655049-dev.to-unclickable-button-fix.css @@ -0,0 +1,12 @@ +/** + * dev.to - not possible to open social buttons menu + * Bug #1655049 - https://bugzilla.mozilla.org/show_bug.cgi?id=1655049 + * WebCompat issue #55782 - https://webcompat.com/issues/55782 + * + * Social buttons menu is not opening due to svg receiving the click + * instead of the button. See https://bugzilla.mozilla.org/show_bug.cgi?id=1654934. + * Adding pointer-events: none to the svg allows to open the menu + */ +#article-show-more-button > * { + pointer-events: none; +} diff --git a/browser/extensions/webcompat/injections/css/bug1666771-zilow-map-overdraw.css b/browser/extensions/webcompat/injections/css/bug1666771-zilow-map-overdraw.css new file mode 100644 index 0000000000..382ed99b50 --- /dev/null +++ b/browser/extensions/webcompat/injections/css/bug1666771-zilow-map-overdraw.css @@ -0,0 +1,17 @@ +/** + * zillow.com - Zillow using massive amounts of memory. + * Bug #1666771 - https://bugzilla.mozilla.org/show_bug.cgi?id=1666771 + * Bug #1662297 - https://bugzilla.mozilla.org/show_bug.cgi?id=1662297 + * + * Zillow's map is using a lot of memory, caused by large amounts of overdraw + * inside the map while rendering object boundaries. Setting `overflow: hidden` + * is a workaround until Zillow addressed this in a more permanent way. + * + * Note that this override is not without side effects: some lines in the map + * may/will be cut off. There is no side-effect free solution to this, and + * not intervening means the browser just freezes. + */ + +.zillow-map-layer svg.full-boundary-svg { + overflow: hidden !important; +} diff --git a/browser/extensions/webcompat/injections/js/bug0000000-testbed-js-injection.js b/browser/extensions/webcompat/injections/js/bug0000000-testbed-js-injection.js new file mode 100644 index 0000000000..4e7db8c5f9 --- /dev/null +++ b/browser/extensions/webcompat/injections/js/bug0000000-testbed-js-injection.js @@ -0,0 +1,11 @@ +"use strict"; + +/* globals exportFunction */ + +Object.defineProperty(window.wrappedJSObject, "isTestFeatureSupported", { + get: exportFunction(function() { + return true; + }, window), + + set: exportFunction(function() {}, window), +}); diff --git a/browser/extensions/webcompat/injections/js/bug1452707-window.controllers-shim-ib.absa.co.za.js b/browser/extensions/webcompat/injections/js/bug1452707-window.controllers-shim-ib.absa.co.za.js new file mode 100644 index 0000000000..d04dcd7638 --- /dev/null +++ b/browser/extensions/webcompat/injections/js/bug1452707-window.controllers-shim-ib.absa.co.za.js @@ -0,0 +1,29 @@ +"use strict"; + +/** + * Bug 1452707 - Build site patch for ib.absa.co.za + * WebCompat issue #16401 - https://webcompat.com/issues/16401 + * + * The online banking at ib.absa.co.za detect if window.controllers is a + * non-falsy value to detect if the current browser is Firefox or something + * else. In bug 1448045, this shim has been disabled for Firefox Nightly 61+, + * which breaks the UA detection on this site and results in a "Browser + * unsuppored" error message. + * + * This site patch simply sets window.controllers to a string, resulting in + * their check to work again. + */ + +/* globals exportFunction */ + +console.info( + "window.controllers has been shimmed for compatibility reasons. See https://webcompat.com/issues/16401 for details." +); + +Object.defineProperty(window.wrappedJSObject, "controllers", { + get: exportFunction(function() { + return true; + }, window), + + set: exportFunction(function() {}, window), +}); diff --git a/browser/extensions/webcompat/injections/js/bug1457335-histography.io-ua-change.js b/browser/extensions/webcompat/injections/js/bug1457335-histography.io-ua-change.js new file mode 100644 index 0000000000..8bbab329c4 --- /dev/null +++ b/browser/extensions/webcompat/injections/js/bug1457335-histography.io-ua-change.js @@ -0,0 +1,34 @@ +"use strict"; + +/** + * Bug 1457335 - histography.io - Override UA & navigator.vendor + * WebCompat issue #1804 - https://webcompat.com/issues/1804 + * + * This site is using a strict matching of navigator.userAgent and + * navigator.vendor to allow access for Safari or Chrome. Here, we set the + * values appropriately so we get recognized as Chrome. + */ + +/* globals exportFunction */ + +console.info( + "The user agent has been overridden for compatibility reasons. See https://webcompat.com/issues/1804 for details." +); + +const CHROME_UA = navigator.userAgent + " Chrome for WebCompat"; + +Object.defineProperty(window.navigator.wrappedJSObject, "userAgent", { + get: exportFunction(function() { + return CHROME_UA; + }, window), + + set: exportFunction(function() {}, window), +}); + +Object.defineProperty(window.navigator.wrappedJSObject, "vendor", { + get: exportFunction(function() { + return "Google Inc."; + }, window), + + set: exportFunction(function() {}, window), +}); diff --git a/browser/extensions/webcompat/injections/js/bug1472075-bankofamerica.com-ua-change.js b/browser/extensions/webcompat/injections/js/bug1472075-bankofamerica.com-ua-change.js new file mode 100644 index 0000000000..0f61422494 --- /dev/null +++ b/browser/extensions/webcompat/injections/js/bug1472075-bankofamerica.com-ua-change.js @@ -0,0 +1,48 @@ +"use strict"; + +/** + * Bug 1472075 - Build UA override for Bank of America for OSX & Linux + * WebCompat issue #2787 - https://webcompat.com/issues/2787 + * + * BoA is showing a red warning to Linux and macOS users, while accepting + * Windows users without warning. From our side, there is no difference here + * and we receive a lot of user complains about the warnings, so we spoof + * as Firefox on Windows in those cases. + */ + +/* globals exportFunction */ + +if (!navigator.platform.includes("Win")) { + console.info( + "The user agent has been overridden for compatibility reasons. See https://webcompat.com/issues/2787 for details." + ); + + const WINDOWS_UA = navigator.userAgent.replace( + /\(.*; rv:/i, + "(Windows NT 10.0; Win64; x64; rv:" + ); + + Object.defineProperty(window.navigator.wrappedJSObject, "userAgent", { + get: exportFunction(function() { + return WINDOWS_UA; + }, window), + + set: exportFunction(function() {}, window), + }); + + Object.defineProperty(window.navigator.wrappedJSObject, "appVersion", { + get: exportFunction(function() { + return "appVersion"; + }, window), + + set: exportFunction(function() {}, window), + }); + + Object.defineProperty(window.navigator.wrappedJSObject, "platform", { + get: exportFunction(function() { + return "Win64"; + }, window), + + set: exportFunction(function() {}, window), + }); +} diff --git a/browser/extensions/webcompat/injections/js/bug1570856-medium.com-menu-isTier1.js b/browser/extensions/webcompat/injections/js/bug1570856-medium.com-menu-isTier1.js new file mode 100644 index 0000000000..f8bb926b60 --- /dev/null +++ b/browser/extensions/webcompat/injections/js/bug1570856-medium.com-menu-isTier1.js @@ -0,0 +1,34 @@ +"use strict"; + +/** + * medium.com - Override window.GLOBALS.useragent.isTier1 to be true + * WebCompat issue #25844 - https://webcompat.com/issues/25844 + * + * This site is not showing main menu when scrolling. There is a GLOBALS variable + * at the bottom of the template being defined based on a server side UA detection. + * Setting window.GLOBALS.useragent.isTier1 to true makes the menu appear when scrolling + */ + +/* globals exportFunction */ + +console.info( + "window.GLOBALS.useragent.isTier1 has been set to true for compatibility reasons. See https://webcompat.com/issues/25844 for details." +); + +let globals = {}; + +Object.defineProperty(window.wrappedJSObject, "GLOBALS", { + get: exportFunction(function() { + return globals; + }, window), + + set: exportFunction(function(value = {}) { + globals = value; + + if (!globals.useragent) { + globals.useragent = {}; + } + + globals.useragent.isTier1 = true; + }, window), +}); diff --git a/browser/extensions/webcompat/injections/js/bug1579159-m.tailieu.vn-pdfjs-worker-disable.js b/browser/extensions/webcompat/injections/js/bug1579159-m.tailieu.vn-pdfjs-worker-disable.js new file mode 100644 index 0000000000..b6600e93f8 --- /dev/null +++ b/browser/extensions/webcompat/injections/js/bug1579159-m.tailieu.vn-pdfjs-worker-disable.js @@ -0,0 +1,28 @@ +"use strict"; + +/** + * m.tailieu.vn - Override PDFJS.disableWorker to be true + * WebCompat issue #39057 - https://webcompat.com/issues/39057 + * + * Custom viewer built with PDF.js is not working in Firefox for Android + * Disabling worker to match Chrome behavior fixes the issue + */ + +/* globals exportFunction */ + +console.info( + "window.PDFJS.disableWorker has been set to true for compatibility reasons. See https://webcompat.com/issues/39057 for details." +); + +let globals = {}; + +Object.defineProperty(window.wrappedJSObject, "PDFJS", { + get: exportFunction(function() { + return globals; + }, window), + + set: exportFunction(function(value = {}) { + globals = value; + globals.disableWorker = true; + }, window), +}); diff --git a/browser/extensions/webcompat/injections/js/bug1605611-maps.google.com-directions-time.js b/browser/extensions/webcompat/injections/js/bug1605611-maps.google.com-directions-time.js new file mode 100644 index 0000000000..aee07df0cc --- /dev/null +++ b/browser/extensions/webcompat/injections/js/bug1605611-maps.google.com-directions-time.js @@ -0,0 +1,82 @@ +"use strict"; + +/* globals exportFunction */ + +/** + * Bug 1605611 - Cannot change Departure/arrival dates in Google Maps on Android + * + * This patch does the following: + * 1. Re-enable the disabled "Leave now" button. + * 2. Fix the precision of datetime-local inputs (to minutes). + * 3. Fixup side effect from enabling the date picker UI via + * injections/css/bug1605611-maps.google.com-directions-time.css + * + * See https://bugzilla.mozilla.org/show_bug.cgi?id=1605611#c0 for details. + */ + +// Step 1. +document.addEventListener("DOMContentLoaded", () => { + // In case the element appeared before the MutationObserver was activated. + for (const elem of document.querySelectorAll( + ".ml-directions-time[disabled]" + )) { + elem.disabled = false; + } + // Start watching for the insertion of the "Leave now" button. + const moOptions = { + attributeFilter: ["disabled"], + attributes: true, + subtree: true, + }; + const mo = new MutationObserver(function(records) { + let restore = false; + for (const { target } of records) { + if (target.classList.contains("ml-directions-time")) { + if (!restore) { + restore = true; + mo.disconnect(); + } + target.disabled = false; + } + } + if (restore) { + mo.observe(document.body, moOptions); + } + }); + mo.observe(document.body, moOptions); +}); + +// Step 2. +const originalValueAsNumberGetter = Object.getOwnPropertyDescriptor( + HTMLInputElement.prototype.wrappedJSObject, + "valueAsNumber" +).get; +Object.defineProperty( + HTMLInputElement.prototype.wrappedJSObject, + "valueAsNumber", + { + configurable: true, + enumerable: true, + get: originalValueAsNumberGetter, + set: exportFunction(function(v) { + if (this.type === "datetime-local" && v) { + const d = new Date(v); + d.setSeconds(0); + d.setMilliseconds(0); + v = d.getTime(); + } + this.valueAsNumber = v; + }, window), + } +); + +// Step 3. +// injections/css/bug1605611-maps.google.com-directions-time.css fixes the bug, +// but a side effect of allowing the user to click on the datetime-local input +// is that the keyboard appears when the native date picker is closed. +// Fix this by unfocusing the datetime-local input upon focus. +document.addEventListener("focusin", ({ target }) => { + if (target.id === "ml-route-options-time-selector-time-input") { + target.blur(); + } +}); diff --git a/browser/extensions/webcompat/injections/js/bug1610358-pcloud.com-appVersion-change.js b/browser/extensions/webcompat/injections/js/bug1610358-pcloud.com-appVersion-change.js new file mode 100644 index 0000000000..c7654227e1 --- /dev/null +++ b/browser/extensions/webcompat/injections/js/bug1610358-pcloud.com-appVersion-change.js @@ -0,0 +1,25 @@ +"use strict"; + +/** + * Bug 1610358 - Add "mobile" to navigator.appVersion + * WebCompat issue #40353 - https://webcompat.com/issues/40353 + * + * the site expecting navigator.appVersion to contain "mobile", + * otherwise it's serving a tablet version for Firefox mobile + */ + +/* globals exportFunction */ + +console.info( + "The user agent has been overridden for compatibility reasons. See https://webcompat.com/issues/40353 for details." +); + +const APP_VERSION = navigator.appVersion + " mobile"; + +Object.defineProperty(window.navigator.wrappedJSObject, "appVersion", { + get: exportFunction(function() { + return APP_VERSION; + }, window), + + set: exportFunction(function() {}, window), +}); diff --git a/browser/extensions/webcompat/injections/js/bug1631811-datastudio.google.com-indexedDB.js b/browser/extensions/webcompat/injections/js/bug1631811-datastudio.google.com-indexedDB.js new file mode 100644 index 0000000000..63bb420d8d --- /dev/null +++ b/browser/extensions/webcompat/injections/js/bug1631811-datastudio.google.com-indexedDB.js @@ -0,0 +1,18 @@ +"use strict"; + +/** + * Bug 1631811 - disable indexedDB for datastudio.google.com iframes + * + * Indexed DB is disabled already for these iframes due to cookie blocking. + * This intervention changes the functionality from throwing a SecurityError + * when indexedDB is accessed to removing it from the window object + */ + +console.info( + "window.indexedDB has been overwritten for compatibility reasons. See https://bugzilla.mozilla.org/show_bug.cgi?id=1631811 for details." +); + +Object.defineProperty(window.wrappedJSObject, "indexedDB", { + get: undefined, + set: undefined, +}); diff --git a/browser/extensions/webcompat/injections/js/bug1665035-dckids.com-cookieEnabled.js b/browser/extensions/webcompat/injections/js/bug1665035-dckids.com-cookieEnabled.js new file mode 100644 index 0000000000..a243fae54a --- /dev/null +++ b/browser/extensions/webcompat/injections/js/bug1665035-dckids.com-cookieEnabled.js @@ -0,0 +1,30 @@ +"use strict"; + +/** + * Bug 1665035 - enable navigator.cookieEnabled and spoof window.navigator on Linux + * + * Some of the games are not starting because navigator.cookieEnabled + * returns false for trackers with ETP strict. Overwriting the value allows + * to play the games. In addition, Linux desktop devices are incorrectly + * flagged as mobile devices (even if ETP is disabled), so spoofing + * window.navigator.platform here. + */ + +console.info( + "window.cookieEnabled has been overwritten for compatibility reasons. See https://bugzilla.mozilla.org/show_bug.cgi?id=1665035 for details." +); + +Object.defineProperty(window.navigator.wrappedJSObject, "cookieEnabled", { + value: true, + writable: false, +}); + +if (navigator.platform.includes("Linux")) { + console.info( + "navigator.platform has been overwritten for compatibility reasons. See https://bugzilla.mozilla.org/show_bug.cgi?id=1665035 for details." + ); + Object.defineProperty(window.navigator.wrappedJSObject, "platform", { + value: "Win64", + writable: false, + }); +} diff --git a/browser/extensions/webcompat/injections/js/bug1677442-store.hp.com-disable-indexeddb.js b/browser/extensions/webcompat/injections/js/bug1677442-store.hp.com-disable-indexeddb.js new file mode 100644 index 0000000000..507e39cff5 --- /dev/null +++ b/browser/extensions/webcompat/injections/js/bug1677442-store.hp.com-disable-indexeddb.js @@ -0,0 +1,20 @@ +"use strict"; + +/** + * Bug 1677442 - disable indexedDB for d3nkfb7815bs43.cloudfront.net + * + * The site embeds an iframe with a 3D viewer. The request fails + * because BabylonJS (the 3d library) tries to access indexedDB + * from the third party context (d3nkfb7815bs43.cloudfront.net) + * Disabling indexedDB fixes it, causing it to fetch the 3d resource + * via network. + */ + +console.info( + "window.indexedDB has been overwritten for compatibility reasons. See https://bugzilla.mozilla.org/show_bug.cgi?id=1677442 for details." +); + +Object.defineProperty(window.wrappedJSObject, "indexedDB", { + get: undefined, + set: undefined, +}); diff --git a/browser/extensions/webcompat/injections/js/bug1682238-gamearter.com-ua-change.js b/browser/extensions/webcompat/injections/js/bug1682238-gamearter.com-ua-change.js new file mode 100644 index 0000000000..8475a9486f --- /dev/null +++ b/browser/extensions/webcompat/injections/js/bug1682238-gamearter.com-ua-change.js @@ -0,0 +1,27 @@ +"use strict"; + +/* + * Bug 1682238 - Override navigator.userAgent for gamearter.com on macOS 11.0 + * Bug 1680516 - Game is not loaded on gamearter.com + * + * Unity < 2021.1.0a2 is unable to correctly parse User Agents with + * "Mac OS X 11.0" in them, so let's override to "Mac OS X 10.16" instead + * for now. + */ + +/* globals exportFunction */ + +if (navigator.userAgent.includes("Mac OS X 11.")) { + console.info( + "The user agent has been overridden for compatibility reasons. See https://bugzilla.mozilla.org/show_bug.cgi?id=1680516 for details." + ); + + let originalUA = navigator.userAgent; + Object.defineProperty(window.navigator.wrappedJSObject, "userAgent", { + get: exportFunction(function() { + return originalUA.replace(/Mac OS X 11\.(\d)+;/, "Mac OS X 10.16;"); + }, window), + + set: exportFunction(function() {}, window), + }); +} |