summaryrefslogtreecommitdiffstats
path: root/dom/workers/remoteworkers/RemoteWorkerTypes.ipdlh
blob: 67a23e9aae3f0e19c1d2f581ba587e88e3d3a433 (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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
/* 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/. */

include ClientIPCTypes;
include IPCServiceWorkerDescriptor;
include IPCServiceWorkerRegistrationDescriptor;
include PBackgroundSharedTypes;
include URIParams;
include DOMTypes;
include NeckoChannelParams;
include ProtocolTypes;

include "mozilla/dom/ClientIPCUtils.h";
include "mozilla/dom/ReferrerInfoUtils.h";
include "mozilla/dom/WorkerIPCUtils.h";

using struct mozilla::void_t from "mozilla/ipc/IPCCore.h";
using mozilla::dom::RequestCredentials from "mozilla/dom/RequestBinding.h";
using mozilla::StorageAccess from "mozilla/StorageAccess.h";
using mozilla::OriginTrials from "mozilla/OriginTrialsIPCUtils.h";
using mozilla::dom::WorkerType from "mozilla/dom/WorkerBinding.h";

namespace mozilla {
namespace dom {

struct ServiceWorkerData {
  IPCServiceWorkerDescriptor descriptor;
  IPCServiceWorkerRegistrationDescriptor registrationDescriptor;
  nsString cacheName;
  uint32_t loadFlags;
  nsString id;
};

union OptionalServiceWorkerData {
  void_t;
  ServiceWorkerData;
};

struct RemoteWorkerData
{
  // This should only be used for devtools.
  nsString originalScriptURL;

  // It is important to pass these as URIParams instead of strings for blob
  // URLs: they carry an additional bit of state with them (mIsRevoked) that
  // gives us a chance to use them, even after they've been revoked. Because
  // we're asynchronously calling into the parent process before potentially
  // loading the worker, it is important to keep this state. Note that this
  // isn't a panacea: once the URL has been revoked, it'll give the worker 5
  // seconds to actually load it; so it's possible to still fail to load the
  // blob URL if it takes too long to do the round trip.
  URIParams baseScriptURL;
  URIParams resolvedScriptURL;

  nsString name;
  WorkerType type;
  RequestCredentials credentials;

  PrincipalInfo loadingPrincipalInfo;
  PrincipalInfo principalInfo;
  PrincipalInfo partitionedPrincipalInfo;

  bool useRegularPrincipal;
  bool hasStorageAccessPermissionGranted;

  CookieJarSettingsArgs cookieJarSettings;

  nsCString domain;

  bool isSecureContext;

  IPCClientInfo? clientInfo;

  nullable nsIReferrerInfo referrerInfo;

  StorageAccess storageAccess;

  bool isThirdPartyContextToTopWindow;

  bool shouldResistFingerprinting;

  OriginTrials originTrials;

  OptionalServiceWorkerData serviceWorkerData;

  nsID agentClusterId;

  // Child process remote type where the worker should only run on.
  nsCString remoteType;
};

// ErrorData/ErrorDataNote correspond to WorkerErrorReport/WorkerErrorNote
// which in turn correspond to JSErrorReport/JSErrorNotes which allows JS to
// report complicated errors such as redeclarations that involve multiple
// distinct lines.  For more generic error-propagation IPC structures, see bug
// 1357463 on making ErrorResult usable over IPC.

struct ErrorDataNote {
  uint32_t lineNumber;
  uint32_t columnNumber;
  nsString message;
  nsString filename;
};

struct ErrorData {
  bool isWarning;
  uint32_t lineNumber;
  uint32_t columnNumber;
  nsString message;
  nsString filename;
  nsString line;
  ErrorDataNote[] notes;
};

union ErrorValue {
  nsresult;
  ErrorData;
  void_t;
};

} // namespace dom
} // namespace mozilla