bug1799980-healow.com-infinite-loop-fix.js (1418B)
1 /* This Source Code Form is subject to the terms of the Mozilla Public 2 * License, v. 2.0. If a copy of the MPL was not distributed with this 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 4 5 "use strict"; 6 7 /** 8 * Bug 1799980 - Healow gets stuck in an infinite loop while pages load 9 * 10 * This patch keeps Healow's localization scripts from getting stuck in 11 * an infinite loop while their pages are loading. 12 * 13 * This happens because they use synchronous XMLHttpRequests to fetch a 14 * JSON file with their localized text on the first call to their i18n 15 * function, and then force subsequent calls to wait for it by waiting 16 * in an infinite loop. 17 * 18 * But since they're in an infinite loop, the code after the syncXHR will 19 * never be able to run, so this ultimately triggers a slow script warning. 20 * 21 * We can improve this by just preventing the infinite loop from happening, 22 * though since they disable caching on their JSON files it means that more 23 * XHRs may happen. But since those files are small, this seems like a 24 * reasonable compromise until they migrate to a better i18n solution. 25 * 26 * See https://bugzilla.mozilla.org/show_bug.cgi?id=1799980 for details. 27 */ 28 29 /* globals exportFunction */ 30 31 Object.defineProperty(window.wrappedJSObject, "ajaxRequestProcessing", { 32 get: exportFunction(function () { 33 return false; 34 }, window), 35 36 set: exportFunction(function () {}, window), 37 });