tor-browser

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

PHttpChannel.ipdl (6209B)


      1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
      2 /* vim: set sw=2 ts=8 et tw=80 ft=cpp : */
      3 
      4 /* This Source Code Form is subject to the terms of the Mozilla Public
      5  * License, v. 2.0. If a copy of the MPL was not distributed with this
      6  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      7 
      8 include protocol PNecko;
      9 include InputStreamParams;
     10 include PBackgroundSharedTypes;
     11 include NeckoChannelParams;
     12 include IPCServiceWorkerDescriptor;
     13 include IPCStream;
     14 include HttpChannelParams;
     15 
     16 include "mozilla/dom/ReferrerInfoUtils.h";
     17 include "mozilla/net/NeckoMessageUtils.h";
     18 include "mozilla/net/ClassOfService.h";
     19 
     20 using mozilla::OriginAttributes from "mozilla/ipc/BackgroundUtils.h";
     21 using mozilla::net::ClassOfService from "mozilla/net/ClassOfService.h";
     22 [RefCounted] using class nsIURI from "mozilla/ipc/URIUtils.h";
     23 
     24 namespace mozilla {
     25 namespace net {
     26 
     27 //-------------------------------------------------------------------
     28 [ChildImpl=virtual, ParentImpl=virtual]
     29 protocol PHttpChannel
     30 {
     31   manager PNecko;
     32 
     33 parent:
     34   // Note: channels are opened during construction, so no open method here:
     35   // see PNecko.ipdl
     36 
     37   async SetClassOfService(ClassOfService cos);
     38 
     39   async Suspend();
     40   async Resume();
     41 
     42   async Cancel(nsresult status, uint32_t requestBlockingReason,
     43                nsCString aReason, nsCString? logString);
     44 
     45   // Reports approval/veto of redirect by child process redirect observers
     46   async Redirect2Verify(nsresult result, RequestHeaderTuples changedHeaders,
     47                         uint32_t sourceRequestBlockingReason,
     48                         ChildLoadInfoForwarderArgs? targetLoadInfoForwarder,
     49                         uint32_t loadFlags,
     50                         nullable nsIReferrerInfo referrerInfo,
     51                         nullable nsIURI apiRedirectTo,
     52                         CorsPreflightArgs? corsPreflightArgs);
     53 
     54   // For document loads we keep this protocol open after child's
     55   // OnStopRequest, and send this msg (instead of __delete__) to allow
     56   // partial cleanup on parent.
     57   async DocumentChannelCleanup(bool clearCacheEntry);
     58 
     59   // Child has detected a CORS check failure, so needs to tell the parent
     60   // to remove any matching entry from the CORS preflight cache.
     61   async RemoveCorsPreflightCacheEntry(nullable nsIURI uri,
     62                                       PrincipalInfo requestingPrincipal,
     63                                       OriginAttributes originAttributes);
     64 
     65   // Send cookies to the parent for a given channel. Compared to PCookieService
     66   // SetCookies this method allows the parent to determine which BrowsingContext
     67   // the request was sent for.
     68   async SetCookies(nsCString baseDomain,
     69                                     OriginAttributes attrs,
     70                                     nullable nsIURI host,
     71                                     bool fromHttp,
     72                                     bool isThirdParty,
     73                                     CookieStruct[] cookies);
     74 
     75   // After receiving this message, the parent calls SendDeleteSelf, and makes
     76   // sure not to send any more messages after that.
     77   async DeletingChannel();
     78 
     79   // Called to get the input stream when altData was delivered.
     80   async OpenOriginalCacheInputStream();
     81 
     82   // Tell the parent the amount bytes read by child for the e10s back pressure
     83   // flow control
     84   async BytesRead(int32_t count);
     85 
     86   async __delete__();
     87 
     88 child:
     89   // Used to cancel child channel if we hit errors during creating and
     90   // AsyncOpen of nsHttpChannel on the parent.
     91   async FailedAsyncOpen(nsresult status);
     92 
     93   // OnStartRequest is sent over PHttpBackgroundChannel. However, sometime we
     94   // need to wait for some PContent IPCs, e.g., permission, cookies. Those IPC
     95   // are sent just before the background thread OnStartRequest, which is racy.
     96   // Therefore, need one main thread IPC event for synchronizing the event
     97   // sequence.
     98   async OnStartRequestSent();
     99 
    100   // Called to initiate content channel redirect, starts talking to sinks
    101   // on the content process and reports result via Redirect2Verify above
    102   async Redirect1Begin(uint32_t           registrarId,
    103                        nullable nsIURI    newOriginalUri,
    104                        uint32_t           newLoadFlags,
    105                        uint32_t           redirectFlags,
    106                        ParentLoadInfoForwarderArgs loadInfoForwarder,
    107                        nsHttpResponseHead responseHead,
    108                        nullable nsITransportSecurityInfo securityInfo,
    109                        uint64_t           channelId,
    110                        NetAddr            oldPeerAddr,
    111                        ResourceTimingStructArgs timing);
    112 
    113   // Called if redirect successful so that child can complete setup.
    114   async Redirect3Complete();
    115 
    116   // Called if the redirect failed/was vetoed
    117   async RedirectFailed(nsresult status);
    118 
    119   // Report a security message to the console associated with this
    120   // channel.
    121   async ReportSecurityMessage(nsString messageTag, nsString messageCategory);
    122 
    123   // Report Local Network Access information to console in content process
    124   // where CallingScriptLocationString() can access JS context.
    125   // topLevelSite must be passed from parent process because with Fission,
    126   // cross-site content processes cannot access top-level document in another process.
    127   async ReportLNAToConsole(NetAddr peerAddr, nsCString messageType, nsCString promptAction, nsCString topLevelSite);
    128 
    129   // Tell child to delete channel (all IPDL deletes must be done from child to
    130   // avoid races: see bug 591708).
    131   async DeleteSelf();
    132 
    133   // When CORS blocks the request in the parent process, it doesn't have the
    134   // correct window ID, so send the message to the child for logging to the web
    135   // console.
    136   async LogBlockedCORSRequest(nsString message,
    137                               nsCString category,
    138                               bool isWarning);
    139 
    140   async LogMimeTypeMismatch(nsCString messageName,
    141                             bool warning,
    142                             nsString url,
    143                             nsString contentType);
    144 
    145   async OriginalCacheInputStreamAvailable(IPCStream? stream);
    146 
    147 
    148 both:
    149   async SetPriority(int16_t priority);
    150 };
    151 
    152 
    153 } // namespace net
    154 } // namespace mozilla