summaryrefslogtreecommitdiffstats
path: root/browser/extensions/webcompat/injections/js/bug1665035-dckids.com-cookieEnabled.js
blob: a243fae54aabf86c0e7103326d4986d4682feb02 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
"use strict";

/**
 * Bug 1665035 - enable navigator.cookieEnabled and spoof window.navigator on Linux
 *
 * Some of the games are not starting because navigator.cookieEnabled
 * returns false for trackers with ETP strict. Overwriting the value allows
 * to play the games. In addition, Linux desktop devices are incorrectly
 * flagged as mobile devices (even if ETP is disabled), so spoofing
 * window.navigator.platform here.
 */

console.info(
  "window.cookieEnabled has been overwritten for compatibility reasons. See https://bugzilla.mozilla.org/show_bug.cgi?id=1665035 for details."
);

Object.defineProperty(window.navigator.wrappedJSObject, "cookieEnabled", {
  value: true,
  writable: false,
});

if (navigator.platform.includes("Linux")) {
  console.info(
    "navigator.platform has been overwritten for compatibility reasons. See https://bugzilla.mozilla.org/show_bug.cgi?id=1665035 for details."
  );
  Object.defineProperty(window.navigator.wrappedJSObject, "platform", {
    value: "Win64",
    writable: false,
  });
}