bug1898951-hexagame.io-prevent-unsupported-alert.js (813B)
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 /* globals exportFunction */ 6 7 "use strict"; 8 9 /** 10 * hexagame.io - Shows an alert recommending other browsers. 11 * Bug #1898951 - https://bugzilla.mozilla.org/show_bug.cgi?id=1898951 12 * WebCompat issue #120035 - https://webcompat.com/issues/120035 13 */ 14 15 console.info( 16 "window.alert is being overriden for compatibility reasons. See https://bugzilla.mozilla.org/show_bug.cgi?id=1898951 for details." 17 ); 18 19 const originalAlert = window.wrappedJSObject.alert; 20 window.wrappedJSObject.alert = exportFunction(function (msg) { 21 if (!msg?.toLowerCase?.().includes("chrome")) { 22 originalAlert(msg); 23 } 24 }, window);