fune/toolkit/components/resistfingerprinting/content/usercharacteristics.js
Sandor Molnar cc6a87da40 Backed out 7 changesets (bug 1894958) for causing bc failures @ browser_usercharacteristics.js CLOSED TREE
Backed out changeset f0b3873afbbf (bug 1894958)
Backed out changeset 0163ab00de90 (bug 1894958)
Backed out changeset dc5209d0115f (bug 1894958)
Backed out changeset c7c58e406791 (bug 1894958)
Backed out changeset 1ff86ac5480e (bug 1894958)
Backed out changeset 862f163cf35c (bug 1894958)
Backed out changeset 4ad50fcd042b (bug 1894958)
2024-06-05 00:07:37 +03:00

52 lines
1.6 KiB
JavaScript

/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
var debugMsgs = [];
function debug(...args) {
let msg = "";
if (!args.length) {
debugMsgs.push("");
return;
}
let stringify = o => {
if (typeof o == "string") {
return o;
}
return JSON.stringify(o);
};
let stringifiedArgs = args.map(stringify);
msg += stringifiedArgs.join(" ");
debugMsgs.push(msg);
}
debug("Debug Line");
debug("Another debug line, with", { an: "object" });
// A hacky way to ensure all GamePad related services are running by the time we
// want to know about GamePads. This will attach a listener for this window to
// the GamePadManager, creating it if it doesn't exist. When GamePadManager is
// created (either now or earlier) it will also create a GamePadEventChannel
// between the GamePadManager and the parent process. When that's created, the
// Parent will create a GamePadPlatformService if it's not already created, and
// when that Service gets created it kicks off a background thread to monitor
// for gamepads attached to the machine. We need to give that background thread
// time to run so all the data is there when we request it.
navigator.getGamepads();
// The first time we put a real value in here, please update browser_usercharacteristics.js
let output = {
foo: "Hello World",
};
document.dispatchEvent(
new CustomEvent("UserCharacteristicsDataDone", {
bubbles: true,
detail: {
debug: debugMsgs,
output,
},
})
);