diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
commit | 26a029d407be480d791972afb5975cf62c9360a6 (patch) | |
tree | f435a8308119effd964b339f76abb83a57c29483 /browser/extensions/webcompat/injections/js/bug1799980-healow.com-infinite-loop-fix.js | |
parent | Initial commit. (diff) | |
download | firefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz firefox-26a029d407be480d791972afb5975cf62c9360a6.zip |
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'browser/extensions/webcompat/injections/js/bug1799980-healow.com-infinite-loop-fix.js')
-rw-r--r-- | browser/extensions/webcompat/injections/js/bug1799980-healow.com-infinite-loop-fix.js | 37 |
1 files changed, 37 insertions, 0 deletions
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..191e97dec1 --- /dev/null +++ b/browser/extensions/webcompat/injections/js/bug1799980-healow.com-infinite-loop-fix.js @@ -0,0 +1,37 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +"use strict"; + +/** + * Bug 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), +}); |