1#include "nsISupports.idl"
2
3interface mozIDOMWindow;
4interface nsIPrincipal;
5
6[scriptable, uuid(9cf3b48e-361d-486a-8917-55cf8d00bb41)]
7interface nsIWorkerDebuggerListener : nsISupports
8{
9  void onClose();
10
11  void onError(in AString filename, in unsigned long lineno,
12               in AString message);
13
14  void onMessage(in AString message);
15};
16
17[scriptable, builtinclass, uuid(22f93aa3-8a05-46be-87e0-fa93bf8a8eff)]
18interface nsIWorkerDebugger : nsISupports
19{
20  const unsigned long TYPE_DEDICATED = 0;
21  const unsigned long TYPE_SHARED = 1;
22  const unsigned long TYPE_SERVICE = 2;
23
24  readonly attribute bool isClosed;
25
26  readonly attribute bool isChrome;
27
28  readonly attribute bool isInitialized;
29
30  readonly attribute nsIWorkerDebugger parent;
31
32  readonly attribute unsigned long type;
33
34  readonly attribute AString url;
35
36  // If this is a dedicated worker, the window this worker or (in the case of
37  // nested workers) its top-level ancestral worker is associated with.
38  readonly attribute mozIDOMWindow window;
39
40  readonly attribute Array<uint64_t> windowIDs;
41
42  readonly attribute nsIPrincipal principal;
43
44  readonly attribute unsigned long serviceWorkerID;
45
46  readonly attribute AString id;
47
48  void initialize(in AString url);
49
50  [binaryname(PostMessageMoz)]
51  void postMessage(in AString message);
52
53  void addListener(in nsIWorkerDebuggerListener listener);
54
55  void removeListener(in nsIWorkerDebuggerListener listener);
56
57  // Indicate whether the debugger has finished initializing. By default the
58  // debugger will be considered initialized when the onRegister hooks in all
59  // nsIWorkerDebuggerManagerListener have been called.
60  //
61  // setDebuggerReady(false) can be called during an onRegister hook to mark
62  // the debugger as not being ready yet. This will prevent all content from
63  // running in the worker, including the worker's main script and any messages
64  // posted to it. Other runnables will still execute in the worker as normal.
65  //
66  // When the debugger is ready, setDebuggerReady(true) should then be called
67  // to allow the worker to begin executing content.
68  void setDebuggerReady(in boolean ready);
69};
70