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/. */
4
5include ClientIPCTypes;
6include IPCServiceWorkerDescriptor;
7include IPCServiceWorkerRegistrationDescriptor;
8include PBackgroundSharedTypes;
9include URIParams;
10include DOMTypes;
11include ProtocolTypes;
12
13using struct mozilla::void_t from "ipc/IPCMessageUtils.h";
14using mozilla::StorageAccess from "mozilla/dom/ClientIPCUtils.h";
15
16namespace mozilla {
17namespace dom {
18
19struct ServiceWorkerData {
20  IPCServiceWorkerDescriptor descriptor;
21  IPCServiceWorkerRegistrationDescriptor registrationDescriptor;
22  nsString cacheName;
23  uint32_t loadFlags;
24  nsString id;
25};
26
27union OptionalServiceWorkerData {
28  void_t;
29  ServiceWorkerData;
30};
31
32struct RemoteWorkerData
33{
34  // This should only be used for devtools.
35  nsString originalScriptURL;
36
37  // It is important to pass these as URIParams instead of strings for blob
38  // URLs: they carry an additional bit of state with them (mIsRevoked) that
39  // gives us a chance to use them, even after they've been revoked. Because
40  // we're asynchronously calling into the parent process before potentially
41  // loading the worker, it is important to keep this state. Note that this
42  // isn't a panacea: once the URL has been revoked, it'll give the worker 5
43  // seconds to actually load it; so it's possible to still fail to load the
44  // blob URL if it takes too long to do the round trip.
45  URIParams baseScriptURL;
46  URIParams resolvedScriptURL;
47
48  nsString name;
49
50  PrincipalInfo loadingPrincipalInfo;
51  PrincipalInfo principalInfo;
52  PrincipalInfo storagePrincipalInfo;
53
54  nsCString domain;
55
56  bool isSecureContext;
57
58  IPCClientInfo? clientInfo;
59
60  nsIReferrerInfo referrerInfo;
61
62  StorageAccess storageAccess;
63
64  OptionalServiceWorkerData serviceWorkerData;
65
66  nsID agentClusterId;
67};
68
69// ErrorData/ErrorDataNote correspond to WorkerErrorReport/WorkerErrorNote
70// which in turn correspond to JSErrorReport/JSErrorNotes which allows JS to
71// report complicated errors such as redeclarations that involve multiple
72// distinct lines.  For more generic error-propagation IPC structures, see bug
73// 1357463 on making ErrorResult usable over IPC.
74
75struct ErrorDataNote {
76  uint32_t lineNumber;
77  uint32_t columnNumber;
78  nsString message;
79  nsString filename;
80};
81
82struct ErrorData {
83  bool isWarning;
84  uint32_t lineNumber;
85  uint32_t columnNumber;
86  nsString message;
87  nsString filename;
88  nsString line;
89  ErrorDataNote[] notes;
90};
91
92union ErrorValue {
93  nsresult;
94  ErrorData;
95  void_t;
96};
97
98} // namespace dom
99} // namespace mozilla
100