diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:22:09 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:22:09 +0000 |
commit | 43a97878ce14b72f0981164f87f2e35e14151312 (patch) | |
tree | 620249daf56c0258faa40cbdcf9cfba06de2a846 /browser/extensions/webcompat/injections | |
parent | Initial commit. (diff) | |
download | firefox-upstream.tar.xz firefox-upstream.zip |
Adding upstream version 110.0.1.upstream/110.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
49 files changed, 930 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/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..ad47c57e55 --- /dev/null +++ b/browser/extensions/webcompat/injections/css/bug1605611-maps.google.com-directions-time.css @@ -0,0 +1,22 @@ +/** + * Bug 1605611 - Cannot change Departure/arrival dates in Google Maps on Android + * + * 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-edit-mode-grey-icon > 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/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/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..5edc344d93 --- /dev/null +++ b/browser/extensions/webcompat/injections/css/bug1653075-livescience.com-scrollbar-width.css @@ -0,0 +1,13 @@ +/** + * 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. + */ + +.trending__list { + scrollbar-width: thin; + scrollbar-color: #f9ae3b #f5f5f5; +} 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/bug1694470-myvidster.com-content-not-shown.css b/browser/extensions/webcompat/injections/css/bug1694470-myvidster.com-content-not-shown.css new file mode 100644 index 0000000000..cb4bfa4f65 --- /dev/null +++ b/browser/extensions/webcompat/injections/css/bug1694470-myvidster.com-content-not-shown.css @@ -0,0 +1,11 @@ +/** + * m.myvidster.com - Content is not shown + * Bug #1694470 - https://bugzilla.mozilla.org/show_bug.cgi?id=1694470 + * WebCompat issue #67308 - https://webcompat.com/issues/67308 + * + * The site depends on Sencha Touch and should receive some specific + * -moz-box-flex to be working. + */ +#home_refresh_var { + -moz-box-flex: 1; +} diff --git a/browser/extensions/webcompat/injections/css/bug1707795-office365-sheets-overscroll-disable.css b/browser/extensions/webcompat/injections/css/bug1707795-office365-sheets-overscroll-disable.css new file mode 100644 index 0000000000..41ee4060f6 --- /dev/null +++ b/browser/extensions/webcompat/injections/css/bug1707795-office365-sheets-overscroll-disable.css @@ -0,0 +1,8 @@ +/** + * www.office.com - There is an overscroll effect on Excel sheets which is + * not a very pleasant user experience. This invention disables it. + */ + +.ewr-sheetcontainer { + overscroll-behavior: none; +} diff --git a/browser/extensions/webcompat/injections/css/bug1712833-buskocchi.desuca.co.jp-fix-map-height.css b/browser/extensions/webcompat/injections/css/bug1712833-buskocchi.desuca.co.jp-fix-map-height.css new file mode 100644 index 0000000000..fb85897406 --- /dev/null +++ b/browser/extensions/webcompat/injections/css/bug1712833-buskocchi.desuca.co.jp-fix-map-height.css @@ -0,0 +1,9 @@ +/** + * buskocchi.desuca.co.jp - Ensure that the map has a height so it is visible. + * Bug #1712833 - https://bugzilla.mozilla.org/show_bug.cgi?id=1712833 + * WebCompat issue #50837 - https://webcompat.com/issues/50837 + */ + +form[name="main"] { + height: 100%; +} diff --git a/browser/extensions/webcompat/injections/css/bug1741234-patient.alphalabs.ca-height-fix.css b/browser/extensions/webcompat/injections/css/bug1741234-patient.alphalabs.ca-height-fix.css new file mode 100644 index 0000000000..03004d00fe --- /dev/null +++ b/browser/extensions/webcompat/injections/css/bug1741234-patient.alphalabs.ca-height-fix.css @@ -0,0 +1,9 @@ +/** + * patient.alphalabs.ca - "Continue" button is overlapped by displaced page footer + * Bug #1741234 - https://bugzilla.mozilla.org/show_bug.cgi?id=1741234 + * WebCompat issue #93156 - https://webcompat.com/issues/93156 + */ + +body { + height: 100%; +} diff --git a/browser/extensions/webcompat/injections/css/bug1748455-reddit.com-gallery-image-width-fix.css b/browser/extensions/webcompat/injections/css/bug1748455-reddit.com-gallery-image-width-fix.css new file mode 100644 index 0000000000..4f4296a346 --- /dev/null +++ b/browser/extensions/webcompat/injections/css/bug1748455-reddit.com-gallery-image-width-fix.css @@ -0,0 +1,9 @@ +/** + * www.reddit.com - Slideshow images have zero width + * Bug #1748455 - https://bugzilla.mozilla.org/show_bug.cgi?id=1748455 + * WebCompat issue #97271 - https://webcompat.com/issues/97271 + */ + +.gallery-img > faceplate-img { + height: auto; +} diff --git a/browser/extensions/webcompat/injections/css/bug1754473-m.intl.taobao.com-number-arrow-buttons-overlapping-fix.css b/browser/extensions/webcompat/injections/css/bug1754473-m.intl.taobao.com-number-arrow-buttons-overlapping-fix.css new file mode 100644 index 0000000000..5161649152 --- /dev/null +++ b/browser/extensions/webcompat/injections/css/bug1754473-m.intl.taobao.com-number-arrow-buttons-overlapping-fix.css @@ -0,0 +1,9 @@ +/** + * m.intl.taobao.com - The quantity value on the shopping cart is hardly + * visible due to https://bugzilla.mozilla.org/show_bug.cgi?id=966844, + * but a CSS change can fix it in the meantime. + * Bug #1754473 - https://bugzilla.mozilla.org/show_bug.cgi?id=1754473 + */ +.o-t-item .item-info .edit-quantity .btn-input input[type="number"] { + appearance: textfield; +} diff --git a/browser/extensions/webcompat/injections/css/bug1765947-veniceincoming.com-left-fix.css b/browser/extensions/webcompat/injections/css/bug1765947-veniceincoming.com-left-fix.css new file mode 100644 index 0000000000..4c2df651ba --- /dev/null +++ b/browser/extensions/webcompat/injections/css/bug1765947-veniceincoming.com-left-fix.css @@ -0,0 +1,9 @@ +/** + * veniceincoming.com - site is not usable + * Bug #1765947 - https://bugzilla.mozilla.org/show_bug.cgi?id=1765947 + * WebCompat issue #102133 - https://webcompat.com/issues/102133 + */ + +.tour-list .single-tour .mobile-link { + left: 0; +} diff --git a/browser/extensions/webcompat/injections/css/bug1770962-coldwellbankerhomes.com-image-height.css b/browser/extensions/webcompat/injections/css/bug1770962-coldwellbankerhomes.com-image-height.css new file mode 100644 index 0000000000..22a6b331d1 --- /dev/null +++ b/browser/extensions/webcompat/injections/css/bug1770962-coldwellbankerhomes.com-image-height.css @@ -0,0 +1,14 @@ +/** + * coldwellbankerhomes.com - Property images are displayed squeezed + * Bug #1770962 - https://bugzilla.mozilla.org/show_bug.cgi?id=1770962 + * WebCompat issue #102872 - https://webcompat.com/issues/102872 + */ + +.property-snapshot-psr-panel + .prop-pix + .photo-carousel.owl + .owl-stage-outer + .owl-item + img { + height: -moz-available; +} diff --git a/browser/extensions/webcompat/injections/css/bug1774490-rainews.it-gallery-fix.css b/browser/extensions/webcompat/injections/css/bug1774490-rainews.it-gallery-fix.css new file mode 100644 index 0000000000..95dbf219c9 --- /dev/null +++ b/browser/extensions/webcompat/injections/css/bug1774490-rainews.it-gallery-fix.css @@ -0,0 +1,9 @@ +/** + * rainews.it - Image slideshow is not shown + * Bug #1774490 - https://bugzilla.mozilla.org/show_bug.cgi?id=1774490 + * WebCompat issue #105402 - https://webcompat.com/issues/105402 + */ + +.photogallery-swiper .swiper-slide { + height: auto; +} diff --git a/browser/extensions/webcompat/injections/css/bug1784141-aveeno.com-acuvue.com-unsupported.css b/browser/extensions/webcompat/injections/css/bug1784141-aveeno.com-acuvue.com-unsupported.css new file mode 100644 index 0000000000..6d3aff1eea --- /dev/null +++ b/browser/extensions/webcompat/injections/css/bug1784141-aveeno.com-acuvue.com-unsupported.css @@ -0,0 +1,13 @@ +/** + * aveeno.com and acuvue.com - Unsupported message is displayed + * + * Bug #1784141 - aveeno.com - https://bugzilla.mozilla.org/show_bug.cgi?id=1784141 + * Bug #1804730 - acuvue.com - https://bugzilla.mozilla.org/show_bug.cgi?id=1804730 + * + * WebCompat issue #103557 - https://webcompat.com/issues/103557 + * WebCompat issue #103557 - https://webcompat.com/issues/110797 + */ + +#browser-alert { + display: none !important; +} diff --git a/browser/extensions/webcompat/injections/css/bug1784195-nutmeg.morrisons.com-overflow.css b/browser/extensions/webcompat/injections/css/bug1784195-nutmeg.morrisons.com-overflow.css new file mode 100644 index 0000000000..3199ca7e6b --- /dev/null +++ b/browser/extensions/webcompat/injections/css/bug1784195-nutmeg.morrisons.com-overflow.css @@ -0,0 +1,9 @@ +/** + * nutmeg.morrisons.com - Menu items overflow content area + * Bug #1784195 - https://bugzilla.mozilla.org/show_bug.cgi?id=1784195 + * WebCompat issue #105417 - https://webcompat.com/issues/105417 + */ + +#sidebar-wrapper { + overflow-x: auto; +} diff --git a/browser/extensions/webcompat/injections/css/bug1784199-entrata-platform-unsupported.css b/browser/extensions/webcompat/injections/css/bug1784199-entrata-platform-unsupported.css new file mode 100644 index 0000000000..78ffaeb53e --- /dev/null +++ b/browser/extensions/webcompat/injections/css/bug1784199-entrata-platform-unsupported.css @@ -0,0 +1,14 @@ +/** + * aptsovation.com - Unsupported message is displayed on sites based on Entrata platform + * Bug #1784199 - https://bugzilla.mozilla.org/show_bug.cgi?id=1784199 + * WebCompat issue #100131 - https://webcompat.com/issues/100131 + */ + +* { + color: unset; +} + +#propertyProduct, +.banner_overlay { + display: none; +} diff --git a/browser/extensions/webcompat/injections/css/bug1784351-movistar.com.ar-overflow-overlay-fix.css b/browser/extensions/webcompat/injections/css/bug1784351-movistar.com.ar-overflow-overlay-fix.css new file mode 100644 index 0000000000..ba8f67d849 --- /dev/null +++ b/browser/extensions/webcompat/injections/css/bug1784351-movistar.com.ar-overflow-overlay-fix.css @@ -0,0 +1,10 @@ +/** + * movistar.com.ar - Page layout is broken + * Bug #1784351 - https://bugzilla.mozilla.org/show_bug.cgi?id=1784351 + * WebCompat issue #108729 - https://webcompat.com/issues/108729 + */ + +.overlay-container { + overflow-x: hidden; + overflow-y: auto; +} diff --git a/browser/extensions/webcompat/injections/css/bug1789164-zdnet.com-cropped-section.css b/browser/extensions/webcompat/injections/css/bug1789164-zdnet.com-cropped-section.css new file mode 100644 index 0000000000..e0615d589c --- /dev/null +++ b/browser/extensions/webcompat/injections/css/bug1789164-zdnet.com-cropped-section.css @@ -0,0 +1,10 @@ +/** + * www.zdnet.com - "ZDNET Recommends" section is cropped + * Bug #1789164 - https://bugzilla.mozilla.org/show_bug.cgi?id=1789164 + * WebCompat issue #109342 - https://webcompat.com/issues/109342 + */ + +.c-featureThreeItems { + margin-left: -1rem; + width: 100vw; +} diff --git a/browser/extensions/webcompat/injections/css/bug1799994-www.vivobarefoot.com-product-filters-fix.css b/browser/extensions/webcompat/injections/css/bug1799994-www.vivobarefoot.com-product-filters-fix.css new file mode 100644 index 0000000000..3684b4d555 --- /dev/null +++ b/browser/extensions/webcompat/injections/css/bug1799994-www.vivobarefoot.com-product-filters-fix.css @@ -0,0 +1,13 @@ +/** + * www.vivobarefoot.com - product filters cannot be interacted-with + * Bug #1799994 - https://bugzilla.mozilla.org/show_bug.cgi?id=1799994 + * WebCompat issue #108752 - https://webcompat.com/issues/108752 + * + * The breakage is actually correct behavior, but because of Chrome + * bug https://bugs.chromium.org/p/chromium/issues/detail?id=606208 + * it is currently not breaking on Chrome. We can work around it by + * bumping the z-index of the filter options. + */ +.page-products .filter-options { + z-index: 2; +} diff --git a/browser/extensions/webcompat/injections/css/bug1800000-www.honda.co.uk-choose-dealer-button-fix.css b/browser/extensions/webcompat/injections/css/bug1800000-www.honda.co.uk-choose-dealer-button-fix.css new file mode 100644 index 0000000000..b1df5f8bc2 --- /dev/null +++ b/browser/extensions/webcompat/injections/css/bug1800000-www.honda.co.uk-choose-dealer-button-fix.css @@ -0,0 +1,13 @@ +/** + * www.honda.co.uk- "choose dealer" buttons cannot be interacted-with + * Bug #1800000 - https://bugzilla.mozilla.org/show_bug.cgi?id=1800000 + * WebCompat issue #109242 - https://webcompat.com/issues/109242 + * + * The breakage is actually correct behavior, but because of Chrome + * bug https://bugs.chromium.org/p/chromium/issues/detail?id=606208 + * it is currently not breaking on Chrome. We can work around it by + * bumping the z-index of the filter options. + */ +.cta-button { + z-index: 2; +} diff --git a/browser/extensions/webcompat/injections/css/bug1800127-www.burgerking.es-webkit-fill-available-fix.css b/browser/extensions/webcompat/injections/css/bug1800127-www.burgerking.es-webkit-fill-available-fix.css new file mode 100644 index 0000000000..12d7fac91d --- /dev/null +++ b/browser/extensions/webcompat/injections/css/bug1800127-www.burgerking.es-webkit-fill-available-fix.css @@ -0,0 +1,13 @@ +/** + * www.burgerking.es - Images are not appearing in the carousel + * Bug #1800127 - https://bugzilla.mozilla.org/show_bug.cgi?id=1800127 + * WebCompat issue #111677 - https://webcompat.com/issues/111677 + * + * The page is not adding -moz-available as a fallback for + * -webkit-fill-available, which we add here. + */ +.bk-feat-prod__img, +.bk-login__hr2, +.bk-hero-for-children__faldon__center { + width: -moz-available; +} diff --git a/browser/extensions/webcompat/injections/css/bug1800143-www.nintendo.co.jp-zoomed-in-image-scrolling-fix.css b/browser/extensions/webcompat/injections/css/bug1800143-www.nintendo.co.jp-zoomed-in-image-scrolling-fix.css new file mode 100644 index 0000000000..f5f0bcf3b7 --- /dev/null +++ b/browser/extensions/webcompat/injections/css/bug1800143-www.nintendo.co.jp-zoomed-in-image-scrolling-fix.css @@ -0,0 +1,11 @@ +/** + * www.nintendo.co.jp - Scrolling is interrupted on zoomed-in images + * Bug #1800143 - https://bugzilla.mozilla.org/show_bug.cgi?id=1800143 + * WebCompat issue #108190 - https://webcompat.com/issues/108190 + * + * The page is not adding a fallback for -webkit-user-drag: none, + * so we add pointer-events:none. + */ +.local-catalog__zoomImageContent img { + pointer-events: none; +} 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/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..7c2c9be7bc --- /dev/null +++ b/browser/extensions/webcompat/injections/js/bug1605611-maps.google.com-directions-time.js @@ -0,0 +1,41 @@ +"use strict"; + +/* globals exportFunction */ + +/** + * Bug 1605611 - Cannot change Departure/arrival dates in Google Maps on Android + * + * This patch re-enables the disabled "Leave now" button. + * + * See https://bugzilla.mozilla.org/show_bug.cgi?id=1605611 for details. + */ + +document.addEventListener("DOMContentLoaded", () => { + // In case the element appeared before the MutationObserver was activated. + for (const elem of document.querySelectorAll(".ml-icon-access-time")) { + elem.parentNode.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.querySelector(".ml-icon-access-time")) { + if (!restore) { + restore = true; + mo.disconnect(); + } + + target.disabled = false; + } + } + if (restore) { + mo.observe(document.body, moOptions); + } + }); + mo.observe(document.body, moOptions); +}); 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/bug1722955-frontgate.com-ua-override.js b/browser/extensions/webcompat/injections/js/bug1722955-frontgate.com-ua-override.js new file mode 100644 index 0000000000..8c229fd0e5 --- /dev/null +++ b/browser/extensions/webcompat/injections/js/bug1722955-frontgate.com-ua-override.js @@ -0,0 +1,17 @@ +"use strict"; + +/* + * Bug 1722955 - Add UA override for frontgate.com + * Webcompat issue #36277 - https://github.com/webcompat/web-bugs/issues/36277 + * + * The website is sending the desktop version to Firefox on mobile devices + * based on UA sniffing. Spoofing as Chrome fixes this. + */ + +/* globals exportFunction, UAHelpers */ + +console.info( + "The user agent has been overridden for compatibility reasons. See https://webcompat.com/issues/36277 for details." +); + +UAHelpers.overrideWithDeviceAppropriateChromeUA(); diff --git a/browser/extensions/webcompat/injections/js/bug1724764-window-print.js b/browser/extensions/webcompat/injections/js/bug1724764-window-print.js new file mode 100644 index 0000000000..7cf2e7e3e5 --- /dev/null +++ b/browser/extensions/webcompat/injections/js/bug1724764-window-print.js @@ -0,0 +1,22 @@ +"use strict"; + +/** + * Generic window.print shim + * + * Issues related to an error caused by missing window.print() method on Android. + * Adding print to the window object allows to unbreak the sites. + */ + +/* globals exportFunction */ + +console.info( + "window.print has been shimmed for compatibility reasons. See https://bugzilla.mozilla.org/show_bug.cgi?id=1659818 for details." +); + +Object.defineProperty(window.wrappedJSObject, "print", { + get: exportFunction(function() { + return true; + }, window), + + set: exportFunction(function() {}, window), +}); diff --git a/browser/extensions/webcompat/injections/js/bug1724868-news.yahoo.co.jp-ua-override.js b/browser/extensions/webcompat/injections/js/bug1724868-news.yahoo.co.jp-ua-override.js new file mode 100644 index 0000000000..a1d353dba9 --- /dev/null +++ b/browser/extensions/webcompat/injections/js/bug1724868-news.yahoo.co.jp-ua-override.js @@ -0,0 +1,25 @@ +"use strict"; + +/** + * Bug 1724868 - news.yahoo.co.jp - Override UA + * WebCompat issue #82605 - https://webcompat.com/issues/82605 + * + * Yahoo Japan news doesn't allow playing video in Firefox on Android + * as they don't have it in their support matrix. They check UA override twice + * and display different ui with the same error. Changing UA to Chrome via + * content script allows playing the videos. + */ + +/* globals exportFunction */ + +console.info( + "The user agent has been overridden for compatibility reasons. See https://webcompat.com/issues/82605 for details." +); + +Object.defineProperty(window.navigator.wrappedJSObject, "userAgent", { + get: exportFunction(function() { + return "Mozilla/5.0 (Linux; Android 11; Pixel 4a) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.159 Mobile Safari/537.36"; + }, window), + + set: exportFunction(function() {}, window), +}); diff --git a/browser/extensions/webcompat/injections/js/bug1731825-office365-email-handling-prompt-autohide.js b/browser/extensions/webcompat/injections/js/bug1731825-office365-email-handling-prompt-autohide.js new file mode 100644 index 0000000000..cf4ea63f40 --- /dev/null +++ b/browser/extensions/webcompat/injections/js/bug1731825-office365-email-handling-prompt-autohide.js @@ -0,0 +1,32 @@ +"use strict"; + +/** + * Bug 1731825 - 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=1731825 for details."; + +const localStorageKey = "mailProtocolHandlerAlreadyOffered"; + +const nav = navigator.wrappedJSObject; +const { registerProtocolHandler } = nav; +const { localStorage } = window.wrappedJSObject; + +Object.defineProperty(navigator.wrappedJSObject, "registerProtocolHandler", { + value: exportFunction(function(scheme, url, title) { + if (localStorage.getItem(localStorageKey)) { + console.info(warning); + return undefined; + } + registerProtocolHandler.call(nav, scheme, url, title); + localStorage.setItem(localStorageKey, true); + return undefined; + }, window), +}); diff --git a/browser/extensions/webcompat/injections/js/bug1739489-draftjs-beforeinput.js b/browser/extensions/webcompat/injections/js/bug1739489-draftjs-beforeinput.js new file mode 100644 index 0000000000..39ce2edf2a --- /dev/null +++ b/browser/extensions/webcompat/injections/js/bug1739489-draftjs-beforeinput.js @@ -0,0 +1,35 @@ +"use strict"; + +/** + * Bug 1739489 - Entering an emoji using the MacOS IME "crashes" Draft.js editors. + */ + +/* globals exportFunction */ + +console.info( + "textInput event has been remapped to beforeinput for compatibility reasons. See https://bugzilla.mozilla.org/show_bug.cgi?id=1739489 for details." +); + +window.wrappedJSObject.TextEvent = window.wrappedJSObject.InputEvent; + +const { CustomEvent, Event, EventTarget } = window.wrappedJSObject; +var Remapped = [ + [CustomEvent, "constructor"], + [Event, "constructor"], + [Event, "initEvent"], + [EventTarget, "addEventListener"], + [EventTarget, "removeEventListener"], +]; + +for (const [obj, name] of Remapped) { + const { prototype } = obj; + const orig = prototype[name]; + Object.defineProperty(prototype, name, { + value: exportFunction(function(type, b, c, d) { + if (type?.toLowerCase() === "textinput") { + type = "beforeinput"; + } + return orig.call(this, type, b, c, d); + }, window), + }); +} diff --git a/browser/extensions/webcompat/injections/js/bug1769762-tiktok.com-plugins-shim.js b/browser/extensions/webcompat/injections/js/bug1769762-tiktok.com-plugins-shim.js new file mode 100644 index 0000000000..12546c6431 --- /dev/null +++ b/browser/extensions/webcompat/injections/js/bug1769762-tiktok.com-plugins-shim.js @@ -0,0 +1,31 @@ +"use strict"; + +/** + * Bug 1769762 - Empty out navigator.plugins + * WebCompat issue #103612 - https://webcompat.com/issues/103612 + * + * Certain features of the site are breaking if navigator.plugins array is not empty: + * + * 1. "Likes" on the comments are not saved + * 2. Can't reply to other people's comments + * 3. "Likes" on the videos are not saved + * 4. Can't follow an account (after refreshing "Follow" button is visible again) + * + * (note that the first 2 are still broken if you open devtools even with this intervention) + */ + +/* globals exportFunction */ + +console.info( + "The PluginArray has been overridden for compatibility reasons. See https://bugzilla.mozilla.org/show_bug.cgi?id=1753874 for details." +); + +const pluginsArray = new window.wrappedJSObject.Array(); +Object.setPrototypeOf(pluginsArray, PluginArray.prototype); + +Object.defineProperty(navigator.wrappedJSObject, "plugins", { + get: exportFunction(function() { + return pluginsArray; + }, window), + set: exportFunction(function(val) {}, window), +}); diff --git a/browser/extensions/webcompat/injections/js/bug1774005-installtrigger-shim.js b/browser/extensions/webcompat/injections/js/bug1774005-installtrigger-shim.js new file mode 100644 index 0000000000..750a72d051 --- /dev/null +++ b/browser/extensions/webcompat/injections/js/bug1774005-installtrigger-shim.js @@ -0,0 +1,22 @@ +"use strict"; + +/** + * Bug 1774005 - Generic window.InstallTrigger shim + * + * This interventions shims window.InstallTrigger to a string, which evaluates + * as `true` in web developers browser sniffing code. This intervention will + * be applied to multiple domains, see bug 1774005 for more information. + */ + +/* globals exportFunction */ + +console.info( + "The InstallTrigger has been shimmed for compatibility reasons. See https://bugzilla.mozilla.org/show_bug.cgi?id=1774005 for details." +); + +Object.defineProperty(window.wrappedJSObject, "InstallTrigger", { + get: exportFunction(function() { + return "This property has been shimed for Web Compatibility reasons."; + }, window), + set: exportFunction(function(_) {}, window), +}); diff --git a/browser/extensions/webcompat/injections/js/bug1778239-m.pji.co.kr-banner-hide.js b/browser/extensions/webcompat/injections/js/bug1778239-m.pji.co.kr-banner-hide.js new file mode 100644 index 0000000000..f93e04b274 --- /dev/null +++ b/browser/extensions/webcompat/injections/js/bug1778239-m.pji.co.kr-banner-hide.js @@ -0,0 +1,18 @@ +"use strict"; + +/** + * Bug 1778239 - Dismiss the "optimized for Chrome" banner on m.pji.co.kr + * + * This interventions force-sets a window variable `flag` to true, to bypass + * the need to use a Chrome user-agent string to hide the banner. + */ + +/* globals exportFunction */ + +Object.defineProperty(window.wrappedJSObject, "flag", { + get: exportFunction(function() { + return true; + }, window), + + set: exportFunction(function() {}, window), +}); diff --git a/browser/extensions/webcompat/injections/js/bug1784302-effectiveType-shim.js b/browser/extensions/webcompat/injections/js/bug1784302-effectiveType-shim.js new file mode 100644 index 0000000000..4e4035b88e --- /dev/null +++ b/browser/extensions/webcompat/injections/js/bug1784302-effectiveType-shim.js @@ -0,0 +1,23 @@ +"use strict"; + +/** + * Bug 1784302 - Issues due to missing navigator.connection after + * https://bugzilla.mozilla.org/show_bug.cgi?id=1637922 landed. + * Webcompat issue #104838 - https://github.com/webcompat/web-bugs/issues/104838 + */ + +/* globals cloneInto, exportFunction */ + +console.info( + "navigator.connection has been shimmed for compatibility reasons. See https://bugzilla.mozilla.org/show_bug.cgi?id=1756692 for details." +); + +var connection = { + addEventListener: () => {}, + removeEventListener: () => {}, + effectiveType: "4g", +}; + +window.navigator.wrappedJSObject.connection = cloneInto(connection, window, { + cloneFunctions: true, +}); diff --git a/browser/extensions/webcompat/injections/js/bug1795490-www.china-airlines.com-undisable-date-fields-on-mobile.js b/browser/extensions/webcompat/injections/js/bug1795490-www.china-airlines.com-undisable-date-fields-on-mobile.js new file mode 100644 index 0000000000..7ef0e28392 --- /dev/null +++ b/browser/extensions/webcompat/injections/js/bug1795490-www.china-airlines.com-undisable-date-fields-on-mobile.js @@ -0,0 +1,36 @@ +"use strict"; + +/** + * Bug 1795490 - Cannot use date fields on China Airlines mobile page + * + * This patch ensures that the search input never has the [disabled] + * attribute, so that users may tap/click on it to search. + * + * See https://bugzilla.mozilla.org/show_bug.cgi?id=1795490 for details. + */ + +const SELECTOR = `#departureDateMobile[disabled], #returnDateMobile[disabled]`; + +function check(target) { + if (target.nodeName === "INPUT" && target.matches(SELECTOR)) { + target.removeAttribute("disabled"); + return true; + } + return false; +} + +new MutationObserver(mutations => { + for (const { addedNodes, target, attributeName } of mutations) { + if (attributeName === "disabled") { + check(target); + } else { + addedNodes?.forEach(node => { + if (!check(node)) { + node + .querySelectorAll?.(SELECTOR) + ?.forEach(n => n.removeAttribute("disabled")); + } + }); + } + } +}).observe(document, { attributes: true, childList: true, subtree: true }); diff --git a/browser/extensions/webcompat/injections/js/bug1799968-www.samsung.com-appVersion-linux-fix.js b/browser/extensions/webcompat/injections/js/bug1799968-www.samsung.com-appVersion-linux-fix.js new file mode 100644 index 0000000000..9181f56eac --- /dev/null +++ b/browser/extensions/webcompat/injections/js/bug1799968-www.samsung.com-appVersion-linux-fix.js @@ -0,0 +1,27 @@ +"use strict"; + +/** + * Bug 1799968 - Build site patch for www.samsung.com + * WebCompat issue #108993 - https://webcompat.com/issues/108993 + * + * Samsung's Watch pages try to detect the OS via navigator.appVersion, + * but fail with Linux because they expect it to contain the literal + * string "linux", and their JS breaks. + * + * As such this site patch sets appVersion to "5.0 (Linux)", and is + * only meant to be applied on Linux. + */ + +/* globals exportFunction */ + +console.info( + "navigator.appVersion has been shimmed for compatibility reasons. See https://webcompat.com/issues/108993 for details." +); + +Object.defineProperty(navigator.wrappedJSObject, "appVersion", { + get: exportFunction(function() { + return "5.0 (Linux)"; + }, window), + + set: exportFunction(function() {}, window), +}); diff --git a/browser/extensions/webcompat/injections/js/bug1799980-healow.com-infinite-loop-fix.js b/browser/extensions/webcompat/injections/js/bug1799980-healow.com-infinite-loop-fix.js new file mode 100644 index 0000000000..b52f1f4702 --- /dev/null +++ b/browser/extensions/webcompat/injections/js/bug1799980-healow.com-infinite-loop-fix.js @@ -0,0 +1,33 @@ +"use strict"; + +/** + * Bug 1799980 - Healow gets stuck in an infinite loop while pages load + * + * This patch keeps Healow's localization scripts from getting stuck in + * an infinite loop while their pages are loading. + * + * This happens because they use synchronous XMLHttpRequests to fetch a + * JSON file with their localized text on the first call to their i18n + * function, and then force subsequent calls to wait for it by waiting + * in an infinite loop. + * + * But since they're in an infinite loop, the code after the syncXHR will + * never be able to run, so this ultimately triggers a slow script warning. + * + * We can improve this by just preventing the infinite loop from happening, + * though since they disable caching on their JSON files it means that more + * XHRs may happen. But since those files are small, this seems like a + * reasonable compromise until they migrate to a better i18n solution. + * + * See https://bugzilla.mozilla.org/show_bug.cgi?id=1799980 for details. + */ + +/* globals exportFunction */ + +Object.defineProperty(window.wrappedJSObject, "ajaxRequestProcessing", { + get: exportFunction(function() { + return false; + }, window), + + set: exportFunction(function() {}, window), +}); diff --git a/browser/extensions/webcompat/injections/js/bug1800131-www.almosafer.com-undisable-date-fields.js b/browser/extensions/webcompat/injections/js/bug1800131-www.almosafer.com-undisable-date-fields.js new file mode 100644 index 0000000000..c897cf31d2 --- /dev/null +++ b/browser/extensions/webcompat/injections/js/bug1800131-www.almosafer.com-undisable-date-fields.js @@ -0,0 +1,39 @@ +"use strict"; + +/** + * Bug 1800131 - Cannot use date fields on Almosafer mobile page + * + * This patch ensures that the search input never has the [disabled] + * attribute, so that users may tap/click on it to search. + * + * See https://bugzilla.mozilla.org/show_bug.cgi?id=1800131 for details. + */ + +const SELECTOR = ` + input[data-testid="FlightHome__DatePicker__DepartureDate"][disabled], + input[data-testid="FlightHome__DatePicker__ReturnDate"][disabled] +`; + +function check(target) { + if (target.nodeName === "INPUT" && target.matches(SELECTOR)) { + target.removeAttribute("disabled"); + return true; + } + return false; +} + +new MutationObserver(mutations => { + for (const { addedNodes, target, attributeName } of mutations) { + if (attributeName === "disabled") { + check(target); + } else { + addedNodes?.forEach(node => { + if (!check(node)) { + node + .querySelectorAll?.(SELECTOR) + ?.forEach(n => n.removeAttribute("disabled")); + } + }); + } + } +}).observe(document, { attributes: true, childList: true, subtree: true }); diff --git a/browser/extensions/webcompat/injections/js/bug1803976-www.youtube.com-performance-now-precision.js b/browser/extensions/webcompat/injections/js/bug1803976-www.youtube.com-performance-now-precision.js new file mode 100644 index 0000000000..68ce9aafda --- /dev/null +++ b/browser/extensions/webcompat/injections/js/bug1803976-www.youtube.com-performance-now-precision.js @@ -0,0 +1,35 @@ +"use strict"; + +/** + * Bug 1803976 - When attempting to go back on youtube.com, the content remains the same + * + * If consecutive session history entries had history.state.entryTime set to same value, + * back button doesn't work as expected. The entryTime value is coming from performance.now() + * and modifying its return value slightly to make sure two close consecutive calls don't + * get the same result helped with resolving the issue. + */ + +/* globals exportFunction */ + +console.info( + "performance.now precision has been modified for compatibility reasons. See https://bugzilla.mozilla.org/show_bug.cgi?id=1756970 for details." +); + +const origPerf = performance.wrappedJSObject; +const origNow = origPerf.now; + +let counter = 0; +let previousVal = 0; + +Object.defineProperty(window.performance.wrappedJSObject, "now", { + value: exportFunction(function() { + let originalVal = origNow.call(origPerf); + if (originalVal === previousVal) { + originalVal += 0.00000003 * ++counter; + } else { + previousVal = originalVal; + counter = 0; + } + return originalVal; + }, window), +}); |