tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

PWindowGlobal.ipdl (9551B)


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