Backed out changeset fe441360b591 (bug 1915216) for causing leaks at ThreadSafeWeakRe...
[gecko.git] / dom / ipc / PWindowGlobal.ipdl
blobd3e132520995f88f8d69f96ef3723781c1d9b27b
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/IdentityCredentialSerializationHelpers.h";
9 include "mozilla/dom/PermissionMessageUtils.h";
10 include "mozilla/dom/SessionStoreMessageUtils.h";
11 include "mozilla/ipc/TransportSecurityInfoUtils.h";
12 include "mozilla/ipc/URIUtils.h";
14 include protocol PBrowser;
15 include protocol PInProcess;
16 include protocol PBrowserBridge;
18 include DOMTypes;
19 include ClientIPCTypes;
20 include IPCIdentityCredential;
21 include NeckoChannelParams;
22 include SessionStoreTypes;
24 include "mozilla/layers/LayersMessageUtils.h";
26 using mozilla::dom::JSActorMessageKind from "mozilla/dom/JSActor.h";
27 using mozilla::gfx::IntRect from "mozilla/gfx/Rect.h";
28 [MoveOnly] using mozilla::gfx::PaintFragment from "mozilla/gfx/CrossProcessPaint.h";
29 using nscolor from "nsColor.h";
30 using mozilla::dom::XPCOMPermitUnloadAction from "nsIDocumentViewer.h";
31 using mozilla::dom::TabId from "mozilla/dom/ipc/IdType.h";
32 using mozilla::layers::LayersId from "mozilla/layers/LayersTypes.h";
33 [RefCounted] using class nsITransportSecurityInfo from "nsITransportSecurityInfo.h";
34 using mozilla::UseCounters from "mozilla/UseCounter.h";
35 using mozilla::dom::MaybeDiscardedWindowContext from "mozilla/dom/WindowContext.h";
36 [RefCounted] using mozilla::dom::SessionStoreRestoreData from "mozilla/dom/SessionStoreRestoreData.h";
37 using mozilla::dom::CredentialMediationRequirement from "mozilla/dom/CredentialManagementBinding.h";
38 using mozilla::dom::IdentityCredentialInit from "mozilla/dom/IdentityCredentialBinding.h";
39 using mozilla::dom::IdentityCredentialRequestOptions from "mozilla/dom/IdentityCredentialBinding.h";
40 using mozilla::dom::IdentityLoginTargetType from "mozilla/dom/IdentityCredentialBinding.h";
42 namespace mozilla {
43 namespace dom {
45 struct JSActorMessageMeta {
46   nsCString actorName;
47   nsString messageName;
48   uint64_t queryId;
49   JSActorMessageKind kind;
52 struct IPCWebShareData
54   nsCString title;
55   nsCString text;
56   nullable nsIURI url;
59 /**
60  * A PWindowGlobal actor has a lifetime matching that of a single Window Global,
61  * specifically a |nsGlobalWindowInner|. These actors will form a parent/child
62  * link either between the chrome/content process, or will be in-process, for
63  * documents which are loaded in the chrome process.
64  */
65 async protocol PWindowGlobal
67   manager PBrowser or PInProcess;
69 child:
70   async __delete__();
72   async MakeFrameLocal(MaybeDiscardedBrowsingContext aFrameContext,
73                        uint64_t aSwitchId);
74   async MakeFrameRemote(MaybeDiscardedBrowsingContext aFrameContext,
75                         ManagedEndpoint<PBrowserBridgeChild> aEndpoint,
76                         TabId aTabId, LayersId aLayersId) returns (bool success);
78   async DrawSnapshot(IntRect? aRect, float aScale, nscolor aBackgroundColor,
79                      uint32_t aFlags) returns (PaintFragment retval);
81   async DispatchSecurityPolicyViolation(nsString aViolationEventJSON);
83   async SaveStorageAccessPermissionGranted();
85   async AddBlockedFrameNodeByClassifier(MaybeDiscardedBrowsingContext aNode);
87   /**
88    * Request from UI to reset the scaling zoom that is controlled by APZ.
89    */
90   async ResetScalingZoom();
92   async RestoreDocShellState(DocShellRestoreState aState)
93     returns (bool success);
95   async RestoreTabContent(nullable SessionStoreRestoreData aData) returns (bool success);
97   async NavigateForIdentityCredentialDiscovery(nsCString aUri, IdentityLoginTargetType aType);
99 both:
100   async RawMessage(JSActorMessageMeta aMetadata, ClonedMessageData? aData,
101                    ClonedMessageData? aStack);
103 parent:
104   // Load the given URI load state into the current owner process of the given
105   // BrowsingContext. aTargetBC must be in the same BrowsingContextGroup as this
106   // window global.
107   async LoadURI(MaybeDiscardedBrowsingContext aTargetBC,
108                 nsDocShellLoadState aLoadState, bool aSetNavigating);
110   async InternalLoad(nsDocShellLoadState aLoadState);
112   /// Update the URI of the document in this WindowGlobal.
113   [LazySend] async UpdateDocumentURI(nsIURI aUri);
115   // We expose frameAncestors to web-extensions and they extract URIs from the
116   // principals collected. In order to be compatible with that API, we need to
117   // update the document's principal. This is only allowed if the principals are
118   // `equals` to each other.
119   [LazySend] async UpdateDocumentPrincipal(nullable nsIPrincipal aPrincipal,
120                                            nullable nsIPrincipal aStoragePrincipal);
122   // Update document's `documentHasLoaded` bit in this WindowGlobal.
123   [LazySend] async UpdateDocumentHasLoaded(bool aDocumentHasLoaded);
125   // Update document's 'documentHasUserInteracted' bit in this WindowGlobal.
126   [LazySend] async UpdateDocumentHasUserInteracted(bool aDocumentHasUserInteracted);
128   // Update document's sandbox flags in this WindowGlobal.
129   [LazySend] async UpdateSandboxFlags(uint32_t aSandboxFlags);
131   // Update document csp's fields in this WindowGlobal.
132   [LazySend] async UpdateDocumentCspSettings(bool aBlockAllMixedContent, bool aUpgradeInsecureRequests);
134   // Update document's cookie settings in this WindowGlobal.
135   [LazySend] async UpdateCookieJarSettings(CookieJarSettingsArgs cookieJarSettings);
137   // Update the title of the document in this WindowGlobal.
138   [LazySend] async UpdateDocumentTitle(nsString aTitle);
140   [LazySend] async UpdateDocumentSecurityInfo(nullable nsITransportSecurityInfo aSecurityInfo);
142   // Update the document's HTTPS-Only Mode flags in this WindowGlobal.
143   [LazySend] async UpdateHttpsOnlyStatus(uint32_t aHttpsOnlyStatus);
145   /// Send down initial document bit to the parent.
146   [LazySend] async SetIsInitialDocument(bool aIsInitialDocument);
148   // Attempts to perform a "Web Share".
149   async Share(IPCWebShareData aData) returns (nsresult rv);
151   // Get content blocking events from the parent process.
152   async GetContentBlockingEvents() returns (uint32_t events);
154   // Send the ClientInfo associated with a top-level document load.
155   [LazySend] async SetClientInfo(IPCClientInfo aClientInfo);
157   // Checks whether any "beforeunload" event listener in the document subtree
158   // wants to block unload, and prompts the user to allow if any does (depending
159   // on the action specified, using nsIDocumentViewer::PermitUnloadAction
160   // values). The sender is responsible for checking documents in its own
161   // process, and passing true for `aHasInProcessBlocker` if any exist. Windows
162   // hosted outside of the caller process will be checked automatically.
163   async CheckPermitUnload(bool aHasInProcessBlocker, XPCOMPermitUnloadAction aAction)
164     returns (bool permitUnload);
166   /**
167    * Informs the parent process that the document in aTop should expect to
168    * receive page use counter contributions from the document in this
169    * WindowGlobal.
170    */
171   async ExpectPageUseCounters(MaybeDiscardedWindowContext aTop);
173   /**
174    * Accumulates use counter data from the document in this WindowGlobal into
175    * the document previously passed into the ExpectPageUseCounters call.
176    */
177   async AccumulatePageUseCounters(UseCounters aUseCounters);
179   async RequestRestoreTabContent();
181   // Add the flags in aOnFlags to the current BFCache status and remove the
182   // flags in aOffFlags from the current BFCache status. See the BFCacheStatus
183   // enum for the valid flags.
184   async UpdateBFCacheStatus(uint32_t aOnFlags, uint32_t aOffFlags);
186   // Signal whether the first connection is added (aIsAdded = true) or
187   // the last connection is removed (aIsAdded = false).
188   async UpdateActivePeerConnectionStatus(bool aIsAdded);
190   /**
191    * Used to notify the parent when there's a change in the number of requests
192    * in the loadgroup. If there are no requests this will be set to Nothing().
193    * If there is one request this will be set to the ID of that request, if it
194    * implements nsIIdentChannel. If there are more than one requests this will
195    * be set to 0.
196    * Note that some requests are ignored (eg. favicon loads).
197    */
198   async SetSingleChannelId(uint64_t? singleChannelId);
200   async SetDocumentDomain(nsIURI aDomain);
202   async Destroy();
204   async ReloadWithHttpsOnlyException();
206   // Used by the Credential Manager API and FedCM to keep the discovery of
207   // a credential abstracted from the content process. This is required because
208   // credentialed requests that are specifically not partitioned are made and
209   // the results must not enter the child process until the user consents via
210   // purpose built UI.
211   async GetIdentityCredential(IdentityCredentialRequestOptions aOptions, CredentialMediationRequirement aMediationRequirement)
212       returns (IPCIdentityCredential? identityCredential, nsresult rv);
213   async StoreIdentityCredential(IPCIdentityCredential aCredential)
214       returns (nsresult rv);
215   async PreventSilentAccess() returns (nsresult rv);
217   async GetStorageAccessPermission(bool aIncludeIdentityCredential) returns(uint32_t permission_action);
220   async SetCookies(nsCString baseDomain,
221                                       OriginAttributes attrs,
222                                       nullable nsIURI host,
223                                       bool fromHttp,
224                                       bool isThirdParty,
225                                       CookieStruct[] cookies);
227   // Notify parent of storage access in the content process. This only happens
228   // once per window lifetime to avoid redundant IPC.
229   async OnInitialStorageAccess();
231   // User activation notifications for BounceTrackingProtection.
232   async RecordUserActivationForBTP();
234 child:
235   async NotifyPermissionChange(nsCString type, uint32_t permission);
238 } // namespace dom
239 } // namespace mozilla