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
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4
5include PBackgroundSharedTypes;
6include IPCServiceWorkerDescriptor;
7
8include "ipc/ErrorIPCUtils.h";
9include "mozilla/dom/ServiceWorkerIPCUtils.h";
10
11using ServiceWorkerUpdateViaCache from "mozilla/dom/ServiceWorkerRegistrationBinding.h";
12using mozilla::CopyableErrorResult from "mozilla/ErrorResult.h";
13
14namespace mozilla {
15namespace dom {
16
17// IPC type with enough information to create a ServiceWorker DOM object
18// in a child process.  Note that the state may be slightly out-of-sync
19// with the parent and should be updated dynamically if necessary.
20[Comparable] struct IPCServiceWorkerRegistrationDescriptor
21{
22  uint64_t id;
23  uint64_t version;
24
25  // These values should match the principal and scope in each
26  // associated worker.  It may be possible to optimize in the future,
27  // but for now we duplicate the information here to ensure correctness.
28  // Its possible we may need to reference a registration before the
29  // worker is installed yet, etc.
30  PrincipalInfo principalInfo;
31  nsCString scope;
32
33  ServiceWorkerUpdateViaCache updateViaCache;
34
35  IPCServiceWorkerDescriptor? installing;
36  IPCServiceWorkerDescriptor? waiting;
37  IPCServiceWorkerDescriptor? active;
38};
39
40union IPCServiceWorkerRegistrationDescriptorOrCopyableErrorResult
41{
42  IPCServiceWorkerRegistrationDescriptor;
43  CopyableErrorResult;
44};
45
46struct IPCServiceWorkerRegistrationDescriptorList
47{
48  IPCServiceWorkerRegistrationDescriptor[] values;
49};
50
51union IPCServiceWorkerRegistrationDescriptorListOrCopyableErrorResult
52{
53  IPCServiceWorkerRegistrationDescriptorList;
54  CopyableErrorResult;
55};
56
57} // namespace dom
58} // namespace mozilla
59