NullHttpChannel.h (1835B)
1 /* This Source Code Form is subject to the terms of the Mozilla Public 2 * License, v. 2.0. If a copy of the MPL was not distributed with this 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 4 5 #ifndef mozilla_net_NullHttpChannel_h 6 #define mozilla_net_NullHttpChannel_h 7 8 #include "nsINullChannel.h" 9 #include "nsIHttpChannel.h" 10 #include "nsITimedChannel.h" 11 #include "nsIURI.h" 12 #include "nsCOMPtr.h" 13 #include "mozilla/TimeStamp.h" 14 #include "nsString.h" 15 #include "prtime.h" 16 17 namespace mozilla { 18 namespace net { 19 20 class nsProxyInfo; 21 22 class NullHttpChannel final : public nsINullChannel, 23 public nsIHttpChannel, 24 public nsITimedChannel { 25 NS_DECL_THREADSAFE_ISUPPORTS 26 NS_DECL_NSINULLCHANNEL 27 NS_DECL_NSIHTTPCHANNEL 28 NS_DECL_NSITIMEDCHANNEL 29 NS_DECL_NSIREQUEST 30 NS_DECL_NSICHANNEL 31 NS_DECL_NSIIDENTCHANNEL 32 33 NullHttpChannel(); 34 35 // Copies the URI, Principal and Timing-Allow-Origin headers from the 36 // passed channel to this object, to be used for resource timing checks 37 explicit NullHttpChannel(nsIHttpChannel* chan); 38 39 // Same signature as nsHttpChannel::Init 40 [[nodiscard]] nsresult Init(nsIURI* aURI, uint32_t aCaps, 41 nsProxyInfo* aProxyInfo, 42 uint32_t aProxyResolveFlags, nsIURI* aProxyURI); 43 44 private: 45 ~NullHttpChannel() = default; 46 47 protected: 48 nsCOMPtr<nsIURI> mURI; 49 nsCOMPtr<nsIURI> mOriginalURI; 50 51 nsString mInitiatorType; 52 PRTime mChannelCreationTime; 53 TimeStamp mAsyncOpenTime; 54 TimeStamp mChannelCreationTimestamp; 55 nsCOMPtr<nsIPrincipal> mResourcePrincipal; 56 nsCString mTimingAllowOriginHeader; 57 bool mAllRedirectsSameOrigin{false}; 58 bool mAllRedirectsPassTimingAllowCheck{false}; 59 }; 60 61 } // namespace net 62 } // namespace mozilla 63 64 #endif // mozilla_net_NullHttpChannel_h