bug1898929-app.sessionlinkpro.com-spoof-user-agent.js (932B)
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 1898929 - UA spoof for app.sessionlinkpro.com 9 * 10 * This site is checking for Chrome in navigator.userAgent and for 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=1898929 for details." 17 ); 18 19 window.wrappedJSObject.chrome = new window.wrappedJSObject.Object(); 20 21 const CHROME_UA = UAHelpers.addChrome(); 22 const nav = Object.getPrototypeOf(navigator.wrappedJSObject); 23 const ua = Object.getOwnPropertyDescriptor(nav, "userAgent"); 24 ua.get = exportFunction(() => CHROME_UA, window); 25 Object.defineProperty(nav, "userAgent", ua);