tor-browser

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

ClientChannelHelper.h (2379B)


      1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
      2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
      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 #ifndef _mozilla_dom_ClientChannelHelper_h
      7 #define _mozilla_dom_ClientChannelHelper_h
      8 
      9 #include "mozilla/Maybe.h"
     10 #include "nsError.h"
     11 
     12 class nsIChannel;
     13 class nsISerialEventTarget;
     14 
     15 namespace mozilla::dom {
     16 
     17 class ClientInfo;
     18 
     19 // Attach a redirect listener to the given nsIChannel that will manage
     20 // the various client values on the channel's LoadInfo.  This will
     21 // properly handle creating a new ClientSource on cross-origin redirect
     22 // and propagate the current reserved/initial client on same-origin
     23 // redirect.
     24 nsresult AddClientChannelHelper(nsIChannel* aChannel,
     25                                Maybe<ClientInfo>&& aReservedClientInfo,
     26                                Maybe<ClientInfo>&& aInitialClientInfo,
     27                                nsISerialEventTarget* aEventTarget);
     28 
     29 // Use this variant in the content process if redirects will be handled in the
     30 // parent process (by a channel with AddClientChannelHelperInParent),
     31 // and this process only sees a single switch to the final channel,
     32 // as done by DocumentChannel.
     33 // This variant just handles allocating a ClientSource around an existing
     34 // ClientInfo allocated in the parent process.
     35 nsresult AddClientChannelHelperInChild(nsIChannel* aChannel,
     36                                       nsISerialEventTarget* aEventTarget);
     37 
     38 // Use this variant in the parent process if redirects are handled there.
     39 // Does the same as the default variant, except just allocates a ClientInfo
     40 // and lets the content process create the corresponding ClientSource once
     41 // it becomes available there.
     42 nsresult AddClientChannelHelperInParent(nsIChannel* aChannel,
     43                                        Maybe<ClientInfo>&& aInitialClientInfo);
     44 
     45 // If the channel's LoadInfo has a reserved ClientInfo, but no reserved
     46 // ClientSource, then allocates a ClientSource using that existing
     47 // ClientInfo.
     48 void CreateReservedSourceIfNeeded(nsIChannel* aChannel,
     49                                  nsISerialEventTarget* aEventTarget);
     50 
     51 }  // namespace mozilla::dom
     52 
     53 #endif  // _mozilla_dom_ClientChannelHelper_h