summaryrefslogtreecommitdiffstats
path: root/dom/chrome-webidl/JSProcessActor.webidl
blob: 13a7062427414f18117e194afd3ebb02fb8385f8 (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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* 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/. */

/**
 * An actor architecture designed to allow compositional parent/content
 * communications. The lifetime of a JSProcessActor{Child, Parent} is the `ContentParent`
 * (for the parent-side) / `ContentChild` (for the child-side).
 */

interface nsISupports;

/**
 * Base class for parent-side actor.
 */
[ChromeOnly, Exposed=Window]
interface JSProcessActorParent {
  [ChromeOnly]
  constructor();

  readonly attribute nsIDOMProcessParent manager;
};
JSProcessActorParent includes JSActor;

[ChromeOnly, Exposed=Window]
interface JSProcessActorChild {
  [ChromeOnly]
  constructor();

  readonly attribute nsIDOMProcessChild manager;
};
JSProcessActorChild includes JSActor;


/**
 * Used by `ChromeUtils.registerProcessActor()` to register actors.
 */
dictionary ProcessActorOptions {
  /**
   * An array of remote type which restricts the actor is allowed to instantiate
   * in specific process type. If this is defined, the prefix of process type
   * matches the remote type by prefix match is allowed to instantiate, ex: if
   * Fission is enabled, the prefix of process type will be `webIsolated`, it
   * can prefix match remote type either `web` or `webIsolated`. If not passed,
   * all content processes are allowed to instantiate the actor.
   */
  sequence<UTF8String> remoteTypes;

  /**
   * If this is set to `true`, allow this actor to be created for the parent
   * process.
   */
  boolean includeParent = false;

  /** This fields are used for configuring individual sides of the actor. */
  ProcessActorSidedOptions parent;
  ProcessActorChildOptions child;
};

dictionary ProcessActorSidedOptions {
  /**
   * The JSM path which should be loaded for the actor on this side.
   *
   * Mutually exclusive with `esModuleURI`.
   *
   * If neither this nor `esModuleURI` is passed, the specified side cannot receive
   * messages, but may send them using `sendAsyncMessage` or `sendQuery`.
   */
  ByteString moduleURI;

  /**
   * The ESM path which should be loaded for the actor on this side.
   *
   * Mutually exclusive with `moduleURI`.
   *
   * If neither this nor `moduleURI` is passed, the specified side cannot
   * receive messages, but may send them using `sendAsyncMessage` or
   * `sendQuery`.
   */
  ByteString esModuleURI;
};

dictionary ProcessActorChildOptions : ProcessActorSidedOptions {
  /**
   * An array of observer topics to listen to. An observer will be added for each
   * topic in the list.
   *
   * Unlike for JSWindowActor, observers are always invoked, and do not need to
   * pass an inner or outer window as subject.
   */
  sequence<ByteString> observers;
};