summaryrefslogtreecommitdiffstats
path: root/dom/workers/nsIWorkerDebugger.idl
blob: 35b58e78e54fd9489edf9bc147338267571f611c (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
#include "nsISupports.idl"

interface mozIDOMWindow;
interface nsIPrincipal;

[scriptable, uuid(9cf3b48e-361d-486a-8917-55cf8d00bb41)]
interface nsIWorkerDebuggerListener : nsISupports
{
  void onClose();

  void onError(in AString filename, in unsigned long lineno,
               in AString message);

  void onMessage(in AString message);
};

[scriptable, builtinclass, uuid(22f93aa3-8a05-46be-87e0-fa93bf8a8eff)]
interface nsIWorkerDebugger : nsISupports
{
  const unsigned long TYPE_DEDICATED = 0;
  const unsigned long TYPE_SHARED = 1;
  const unsigned long TYPE_SERVICE = 2;

  readonly attribute bool isClosed;

  readonly attribute bool isChrome;

  readonly attribute bool isInitialized;

  readonly attribute nsIWorkerDebugger parent;

  readonly attribute unsigned long type;

  readonly attribute AString url;

  // If this is a dedicated worker, the window this worker or (in the case of
  // nested workers) its top-level ancestral worker is associated with.
  readonly attribute mozIDOMWindow window;

  readonly attribute Array<uint64_t> windowIDs;

  readonly attribute nsIPrincipal principal;

  readonly attribute unsigned long serviceWorkerID;

  readonly attribute AString id;

  void initialize(in AString url);

  [binaryname(PostMessageMoz)]
  void postMessage(in AString message);

  void addListener(in nsIWorkerDebuggerListener listener);

  void removeListener(in nsIWorkerDebuggerListener listener);

  // Indicate whether the debugger has finished initializing. By default the
  // debugger will be considered initialized when the onRegister hooks in all
  // nsIWorkerDebuggerManagerListener have been called.
  //
  // setDebuggerReady(false) can be called during an onRegister hook to mark
  // the debugger as not being ready yet. This will prevent all content from
  // running in the worker, including the worker's main script and any messages
  // posted to it. Other runnables will still execute in the worker as normal.
  //
  // When the debugger is ready, setDebuggerReady(true) should then be called
  // to allow the worker to begin executing content.
  void setDebuggerReady(in boolean ready);
};