bug1943898-www.capital.gr-suppress-constant-reloading.js (1206B)
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 * www.capital.gr - Reloading the page results in endless reloading loops. 9 * Bug #1943898 - https://bugzilla.mozilla.org/show_bug.cgi?id=1943898 10 * WebCompat issue #74073 - https://webcompat.com/issues/74073 11 * 12 * The site does not anticipate Firefox's form-filling behavior on page 13 * reloads, which causes it to accidentally trigger endless reload loops. 14 * We fix this by clearing the form element as they check it the first time. 15 */ 16 17 /* globals exportFunction */ 18 19 console.info( 20 "setTimeout has been overridden for compatibility reasons. See https://bugzilla.mozilla.org/show_bug.cgi?id=1943898 for details." 21 ); 22 23 window.wrappedJSObject.setTimeout = exportFunction(function (fn, time) { 24 const text = "" + fn; 25 if ( 26 text.includes("var el = document.getElementById('alwaysFetch');") && 27 text.includes("el.value = el.value ? location.reload() : true;") 28 ) { 29 document.getElementById("alwaysFetch").value = ""; 30 } 31 return window.setTimeout(fn, time); 32 }, window);