tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

bug1902416-www.acionafacil.com.br-prevent-unsupported-alert.js (812B)


      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 * www.acionafacil.com.br - Shows an alert recommending Chrome.
     11 * Bug #1902416 - https://bugzilla.mozilla.org/show_bug.cgi?id=1902416
     12 *
     13 * We can intercept the call to alert and hide it.
     14 */
     15 
     16 console.info(
     17  "window.alert is being overriden for compatibility reasons. See https://bugzilla.mozilla.org/show_bug.cgi?id=1902416 for details."
     18 );
     19 
     20 const originalAlert = window.wrappedJSObject.alert;
     21 window.wrappedJSObject.alert = exportFunction(function (msg) {
     22  if (!msg?.toLowerCase?.().includes("google chrome")) {
     23    originalAlert(msg);
     24  }
     25 }, window);