tor-browser

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

bug1950282-formula1.com-platform-linux-fix.js (961B)


      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 1950282 - navigator.platform Windowss override for Formula 1 TV on Linux
      9 *
     10 * Formula1 TV is doing some kind of check for Android devices which is
     11 * causing it to treat Firefox on Linux as an Android device, and blocking it.
     12 * Overriding navigator.platform to Win64 on Linux works around this issue.
     13 */
     14 
     15 /* globals exportFunction */
     16 
     17 console.info(
     18  "navigator.platform has been overridden for compatibility reasons. See https://bugzilla.mozilla.org/show_bug.cgi?id=1950282 for details."
     19 );
     20 
     21 const nav = Object.getPrototypeOf(navigator.wrappedJSObject);
     22 const platform = Object.getOwnPropertyDescriptor(nav, "platform");
     23 platform.get = exportFunction(() => "Win64", window);
     24 Object.defineProperty(nav, "platform", platform);