tor-browser

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

bug1975651-comic.k-manga.jp-ua-override.js (876B)


      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 1975651 - User agent override for comic.k-manga.jp
      9 */
     10 
     11 /* globals exportFunction, UAHelpers */
     12 
     13 console.info(
     14  "The user agent and navigator.appVersion have been shimmed for compatibility reasons. See https://bugzilla.mozilla.org/show_bug.cgi?id=1975651 for details."
     15 );
     16 
     17 UAHelpers.overrideWithDeviceAppropriateChromeUA();
     18 
     19 const appVer = navigator.wrappedJSObject.userAgent.replace("Mozilla/", "");
     20 const nav = Object.getPrototypeOf(navigator.wrappedJSObject);
     21 const appVersion = Object.getOwnPropertyDescriptor(nav, "appVersion");
     22 appVersion.get = exportFunction(() => appVer, window);
     23 Object.defineProperty(nav, "appVersion", appVersion);