tor-browser

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

bug1902407-www.sigadoc.mt.gov.br-user-agent-spoof.js (929B)


      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 1902407 - UA spoof for www.sigadoc.mt.gov.br
      9 *
     10 * This site is checking for Chrome in navigator.userAgent and window.chrome, so let's spoof those.
     11 */
     12 
     13 /* globals exportFunction, UAHelpers */
     14 
     15 console.info(
     16  "navigator.userAgent and window.chrome are being shimmed for compatibility reasons. https://bugzilla.mozilla.org/show_bug.cgi?id=1902407 for details."
     17 );
     18 
     19 window.wrappedJSObject.chrome = new window.wrappedJSObject.Object();
     20 
     21 const CHROME_UA = UAHelpers.addChrome();
     22 
     23 const nav = Object.getPrototypeOf(navigator.wrappedJSObject);
     24 
     25 const ua = Object.getOwnPropertyDescriptor(nav, "userAgent");
     26 ua.get = exportFunction(() => CHROME_UA, window);
     27 Object.defineProperty(nav, "userAgent", ua);