1 /* -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 8 -*- */
2 /* vim: set sw=2 ts=8 et tw=80 ft=cpp : */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 include "mozilla/dom/DocShellMessageUtils.h";
8 include "mozilla/dom/FeaturePolicyUtils.h";
9 include "mozilla/dom/IdentityCredentialSerializationHelpers.h";
10 include "mozilla/dom/PermissionMessageUtils.h";
11 include "mozilla/dom/SessionStoreMessageUtils.h";
12 include "mozilla/ipc/TransportSecurityInfoUtils.h";
13 include "mozilla/ipc/URIUtils.h";
15 include protocol PBrowser;
16 include protocol PInProcess;
17 include protocol PBrowserBridge;
20 include ClientIPCTypes;
21 include IPCIdentityCredential;
22 include NeckoChannelParams;
23 include SessionStoreTypes;
25 include "mozilla/layers/LayersMessageUtils.h";
27 using mozilla::dom::JSActorMessageKind from "mozilla/dom/JSActor.h";
28 using mozilla::gfx::IntRect from "mozilla/gfx/Rect.h";
29 [MoveOnly] using mozilla::gfx::PaintFragment from "mozilla/gfx/CrossProcessPaint.h";
30 using nscolor from "nsColor.h";
31 using mozilla::dom::XPCOMPermitUnloadAction from "nsIDocumentViewer.h";
32 using mozilla::dom::TabId from "mozilla/dom/ipc/IdType.h";
33 using mozilla::layers::LayersId from "mozilla/layers/LayersTypes.h";
34 [RefCounted] using class nsITransportSecurityInfo from "nsITransportSecurityInfo.h";
35 using mozilla::UseCounters from "mozilla/UseCounter.h";
36 using mozilla::dom::MaybeDiscardedWindowContext from "mozilla/dom/WindowContext.h";
37 [RefCounted] using mozilla::dom::FeaturePolicy from "mozilla/dom/FeaturePolicy.h";
38 [RefCounted] using mozilla::dom::SessionStoreRestoreData from "mozilla/dom/SessionStoreRestoreData.h";
39 using mozilla::dom::IdentityCredentialRequestOptions from "mozilla/dom/IdentityCredentialBinding.h";
44 struct JSActorMessageMeta {
48 JSActorMessageKind kind;
51 struct IPCWebShareData
59 * A PWindowGlobal actor has a lifetime matching that of a single Window Global,
60 * specifically a |nsGlobalWindowInner|. These actors will form a parent/child
61 * link either between the chrome/content process, or will be in-process, for
62 * documents which are loaded in the chrome process.
64 async protocol PWindowGlobal
66 manager PBrowser or PInProcess;
71 async MakeFrameLocal(MaybeDiscardedBrowsingContext aFrameContext,
73 async MakeFrameRemote(MaybeDiscardedBrowsingContext aFrameContext,
74 ManagedEndpoint<PBrowserBridgeChild> aEndpoint,
75 TabId aTabId, LayersId aLayersId) returns (bool success);
77 async DrawSnapshot(IntRect? aRect, float aScale, nscolor aBackgroundColor,
78 uint32_t aFlags) returns (PaintFragment retval);
80 async DispatchSecurityPolicyViolation(nsString aViolationEventJSON);
82 async SaveStorageAccessPermissionGranted();
84 async AddBlockedFrameNodeByClassifier(MaybeDiscardedBrowsingContext aNode);
87 * Request from UI to reset the scaling zoom that is controlled by APZ.
89 async ResetScalingZoom();
91 async SetContainerFeaturePolicy(nullable FeaturePolicy aContainerFeaturePolicy);
93 async RestoreDocShellState(DocShellRestoreState aState)
94 returns (bool success);
96 async RestoreTabContent(nullable SessionStoreRestoreData aData) returns (bool success);
99 async RawMessage(JSActorMessageMeta aMetadata, ClonedMessageData? aData,
100 ClonedMessageData? aStack);
103 // Load the given URI load state into the current owner process of the given
104 // BrowsingContext. aTargetBC must be in the same BrowsingContextGroup as this
106 async LoadURI(MaybeDiscardedBrowsingContext aTargetBC,
107 nsDocShellLoadState aLoadState, bool aSetNavigating);
109 async InternalLoad(nsDocShellLoadState aLoadState);
111 /// Update the URI of the document in this WindowGlobal.
112 [LazySend] async UpdateDocumentURI(nullable nsIURI aUri);
114 // We expose frameAncestors to web-extensions and they extract URIs from the
115 // principals collected. In order to be compatible with that API, we need to
116 // update the document's principal. This is only allowed if the principals are
117 // `equals` to each other.
118 [LazySend] async UpdateDocumentPrincipal(nullable nsIPrincipal aPrincipal,
119 nullable nsIPrincipal aStoragePrincipal);
121 // Update document's `documentHasLoaded` bit in this WindowGlobal.
122 [LazySend] async UpdateDocumentHasLoaded(bool aDocumentHasLoaded);
124 // Update document's 'documentHasUserInteracted' bit in this WindowGlobal.
125 [LazySend] async UpdateDocumentHasUserInteracted(bool aDocumentHasUserInteracted);
127 // Update document's sandbox flags in this WindowGlobal.
128 [LazySend] async UpdateSandboxFlags(uint32_t aSandboxFlags);
130 // Update document csp's fields in this WindowGlobal.
131 [LazySend] async UpdateDocumentCspSettings(bool aBlockAllMixedContent, bool aUpgradeInsecureRequests);
133 // Update document's cookie settings in this WindowGlobal.
134 [LazySend] async UpdateCookieJarSettings(CookieJarSettingsArgs cookieJarSettings);
136 // Update the title of the document in this WindowGlobal.
137 [LazySend] async UpdateDocumentTitle(nsString aTitle);
139 [LazySend] async UpdateDocumentSecurityInfo(nullable nsITransportSecurityInfo aSecurityInfo);
141 // Update the document's HTTPS-Only Mode flags in this WindowGlobal.
142 [LazySend] async UpdateHttpsOnlyStatus(uint32_t aHttpsOnlyStatus);
144 /// Send down initial document bit to the parent.
145 [LazySend] async SetIsInitialDocument(bool aIsInitialDocument);
147 // Attempts to perform a "Web Share".
148 async Share(IPCWebShareData aData) returns (nsresult rv);
150 // Get content blocking events from the parent process.
151 async GetContentBlockingEvents() returns (uint32_t events);
153 // Send the ClientInfo associated with a top-level document load.
154 [LazySend] async SetClientInfo(IPCClientInfo aClientInfo);
156 // Checks whether any "beforeunload" event listener in the document subtree
157 // wants to block unload, and prompts the user to allow if any does (depending
158 // on the action specified, using nsIDocumentViewer::PermitUnloadAction
159 // values). The sender is responsible for checking documents in its own
160 // process, and passing true for `aHasInProcessBlocker` if any exist. Windows
161 // hosted outside of the caller process will be checked automatically.
162 async CheckPermitUnload(bool aHasInProcessBlocker, XPCOMPermitUnloadAction aAction)
163 returns (bool permitUnload);
166 * Informs the parent process that the document in aTop should expect to
167 * receive page use counter contributions from the document in this
170 async ExpectPageUseCounters(MaybeDiscardedWindowContext aTop);
173 * Accumulates use counter data from the document in this WindowGlobal into
174 * the document previously passed into the ExpectPageUseCounters call.
176 async AccumulatePageUseCounters(UseCounters aUseCounters);
178 async RequestRestoreTabContent();
180 // Add the flags in aOnFlags to the current BFCache status and remove the
181 // flags in aOffFlags from the current BFCache status. See the BFCacheStatus
182 // enum for the valid flags.
183 async UpdateBFCacheStatus(uint32_t aOnFlags, uint32_t aOffFlags);
185 // Signal whether the first connection is added (aIsAdded = true) or
186 // the last connection is removed (aIsAdded = false).
187 async UpdateActivePeerConnectionStatus(bool aIsAdded);
190 * Used to notify the parent when there's a change in the number of requests
191 * in the loadgroup. If there are no requests this will be set to Nothing().
192 * If there is one request this will be set to the ID of that request, if it
193 * implements nsIIdentChannel. If there are more than one requests this will
195 * Note that some requests are ignored (eg. favicon loads).
197 async SetSingleChannelId(uint64_t? singleChannelId);
199 async SetDocumentDomain(nullable nsIURI aDomain);
203 async ReloadWithHttpsOnlyException();
205 // Used by the Credential Manager API and FedCM to keep the discovery of
206 // a credential abstracted from the content process. This is required because
207 // credentialed requests that are specifically not partitioned are made and
208 // the results must not enter the child process until the user consents via
210 async DiscoverIdentityCredentialFromExternalSource(IdentityCredentialRequestOptions aOptions)
211 returns (IPCIdentityCredential? identityCredential);
213 async GetStorageAccessPermission() returns(uint32_t permission_action);
216 async SetCookies(nsCString baseDomain,
217 OriginAttributes attrs,
218 nullable nsIURI host,
220 CookieStruct[] cookies);
223 async NotifyPermissionChange(nsCString type, uint32_t permission);
227 } // namespace mozilla