bug1970810-www.camper-van-week-end.fr-appVersion-linux-fix.js (1039B)
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 1970810 - camper-van-week-end.fr/chantilly does not load on Linux 9 * WebCompat issue #155547 - https://webcompat.com/issues/155547 10 * 11 * The page expects navigator.appVersion to contain the literal string 12 * "linux" on Linux, and their JS otherwise breaks. 13 * 14 * As such this site patch sets appVersion to "5.0 (Linux)", and is 15 * only meant to be applied on Linux. 16 */ 17 18 /* globals exportFunction */ 19 20 console.info( 21 "navigator.appVersion has been shimmed for compatibility reasons. See https://bugzilla.mozilla.org/show_bug.cgi?id=1970810 for details." 22 ); 23 24 const nav = Object.getPrototypeOf(navigator.wrappedJSObject); 25 const appVersion = Object.getOwnPropertyDescriptor(nav, "appVersion"); 26 appVersion.get = exportFunction(() => "5.0 (Linux)", window); 27 Object.defineProperty(nav, "appVersion", appVersion);