Bug 1869043 add a main thread record of track audio outputs r=padenot
[gecko.git] / remote / shared / AppInfo.sys.mjs
blob9e354503ef2fb2596aa849a4b848629e966f0a58
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 file,
3  * You can obtain one at http://mozilla.org/MPL/2.0/. */
5 import { AppConstants } from "resource://gre/modules/AppConstants.sys.mjs";
7 const ID_FIREFOX = "{ec8030f7-c20a-464f-9b0e-13a3a9e97384}";
8 const ID_THUNDERBIRD = "{3550f703-e582-4d05-9a08-453d09bdfdc6}";
10 /**
11  * Extends Services.appinfo with further properties that are
12  * used by different protocols as handled by the Remote Agent.
13  *
14  * @typedef {object} RemoteAgent.AppInfo
15  * @property {boolean} isAndroid - Whether the application runs on Android.
16  * @property {boolean} isLinux - Whether the application runs on Linux.
17  * @property {boolean} isMac - Whether the application runs on Mac OS.
18  * @property {boolean} isWindows - Whether the application runs on Windows.
19  * @property {boolean} isFirefox - Whether the application is Firefox.
20  * @property {boolean} isThunderbird - Whether the application is Thunderbird.
21  *
22  * @since 88
23  */
24 export const AppInfo = new Proxy(
25   {},
26   {
27     get(target, prop, receiver) {
28       if (target.hasOwnProperty(prop)) {
29         return target[prop];
30       }
32       return Services.appinfo[prop];
33     },
34   }
37 // Platform support
39 ChromeUtils.defineLazyGetter(AppInfo, "isAndroid", () => {
40   return Services.appinfo.OS === "Android";
41 });
43 ChromeUtils.defineLazyGetter(AppInfo, "isLinux", () => {
44   return Services.appinfo.OS === "Linux";
45 });
47 ChromeUtils.defineLazyGetter(AppInfo, "isMac", () => {
48   return Services.appinfo.OS === "Darwin";
49 });
51 ChromeUtils.defineLazyGetter(AppInfo, "isWindows", () => {
52   return Services.appinfo.OS === "WINNT";
53 });
55 // Application type
57 ChromeUtils.defineLazyGetter(AppInfo, "isFirefox", () => {
58   return Services.appinfo.ID == ID_FIREFOX;
59 });
61 ChromeUtils.defineLazyGetter(AppInfo, "isThunderbird", () => {
62   return Services.appinfo.ID == ID_THUNDERBIRD;
63 });
65 export function getTimeoutMultiplier() {
66   if (
67     AppConstants.DEBUG ||
68     AppConstants.MOZ_CODE_COVERAGE ||
69     AppConstants.ASAN
70   ) {
71     return 4;
72   }
73   if (AppConstants.TSAN) {
74     return 8;
75   }
77   return 1;