summaryrefslogtreecommitdiffstats
path: root/browser/extensions/webcompat/injections/js
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
commit43a97878ce14b72f0981164f87f2e35e14151312 (patch)
tree620249daf56c0258faa40cbdcf9cfba06de2a846 /browser/extensions/webcompat/injections/js
parentInitial commit. (diff)
downloadfirefox-43a97878ce14b72f0981164f87f2e35e14151312.tar.xz
firefox-43a97878ce14b72f0981164f87f2e35e14151312.zip
Adding upstream version 110.0.1.upstream/110.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'browser/extensions/webcompat/injections/js')
-rw-r--r--browser/extensions/webcompat/injections/js/bug0000000-testbed-js-injection.js11
-rw-r--r--browser/extensions/webcompat/injections/js/bug1452707-window.controllers-shim-ib.absa.co.za.js29
-rw-r--r--browser/extensions/webcompat/injections/js/bug1457335-histography.io-ua-change.js34
-rw-r--r--browser/extensions/webcompat/injections/js/bug1472075-bankofamerica.com-ua-change.js48
-rw-r--r--browser/extensions/webcompat/injections/js/bug1579159-m.tailieu.vn-pdfjs-worker-disable.js28
-rw-r--r--browser/extensions/webcompat/injections/js/bug1605611-maps.google.com-directions-time.js41
-rw-r--r--browser/extensions/webcompat/injections/js/bug1631811-datastudio.google.com-indexedDB.js18
-rw-r--r--browser/extensions/webcompat/injections/js/bug1722955-frontgate.com-ua-override.js17
-rw-r--r--browser/extensions/webcompat/injections/js/bug1724764-window-print.js22
-rw-r--r--browser/extensions/webcompat/injections/js/bug1724868-news.yahoo.co.jp-ua-override.js25
-rw-r--r--browser/extensions/webcompat/injections/js/bug1731825-office365-email-handling-prompt-autohide.js32
-rw-r--r--browser/extensions/webcompat/injections/js/bug1739489-draftjs-beforeinput.js35
-rw-r--r--browser/extensions/webcompat/injections/js/bug1769762-tiktok.com-plugins-shim.js31
-rw-r--r--browser/extensions/webcompat/injections/js/bug1774005-installtrigger-shim.js22
-rw-r--r--browser/extensions/webcompat/injections/js/bug1778239-m.pji.co.kr-banner-hide.js18
-rw-r--r--browser/extensions/webcompat/injections/js/bug1784302-effectiveType-shim.js23
-rw-r--r--browser/extensions/webcompat/injections/js/bug1795490-www.china-airlines.com-undisable-date-fields-on-mobile.js36
-rw-r--r--browser/extensions/webcompat/injections/js/bug1799968-www.samsung.com-appVersion-linux-fix.js27
-rw-r--r--browser/extensions/webcompat/injections/js/bug1799980-healow.com-infinite-loop-fix.js33
-rw-r--r--browser/extensions/webcompat/injections/js/bug1800131-www.almosafer.com-undisable-date-fields.js39
-rw-r--r--browser/extensions/webcompat/injections/js/bug1803976-www.youtube.com-performance-now-precision.js35
21 files changed, 604 insertions, 0 deletions
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),
+});