summaryrefslogtreecommitdiffstats
path: root/toolkit/modules/ProcessType.sys.mjs
blob: 4c30068755654482804b250e4c030bbb68b761d0 (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
31
32
33
34
/* 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 http://mozilla.org/MPL/2.0/. */

export const ProcessType = Object.freeze({
  /**
   * Converts a key string to a fluent ID defined in processTypes.ftl.
   */
  kProcessTypeMap: {
    // Keys defined in xpcom/build/GeckoProcessTypes.h
    default: "process-type-default",
    gpu: "process-type-gpu",
    tab: "process-type-tab",
    rdd: "process-type-rdd",
    socket: "process-type-socket",
    utility: "process-type-utility",

    // Keys defined in dom/ipc/RemoteType.h
    extension: "process-type-extension",
    file: "process-type-file",
    prealloc: "process-type-prealloc",
    privilegedabout: "process-type-privilegedabout",
    privilegedmozilla: "process-type-privilegedmozilla",
    web: "process-type-web",
    webIsolated: "process-type-webisolated",
    webServiceWorker: "process-type-webserviceworker",
  },

  kFallback: "process-type-unknown",

  fluentNameFromProcessTypeString(type) {
    return this.kProcessTypeMap[type] || this.kFallback;
  },
});