diff options
Diffstat (limited to 'netwerk/base/nsBaseChannel.h')
-rw-r--r-- | netwerk/base/nsBaseChannel.h | 46 |
1 files changed, 7 insertions, 39 deletions
diff --git a/netwerk/base/nsBaseChannel.h b/netwerk/base/nsBaseChannel.h index 179a24bf45..c0db8e2500 100644 --- a/netwerk/base/nsBaseChannel.h +++ b/netwerk/base/nsBaseChannel.h @@ -6,13 +6,16 @@ #ifndef nsBaseChannel_h__ #define nsBaseChannel_h__ +#include "mozilla/dom/MimeType.h" #include "mozilla/Maybe.h" #include "mozilla/MozPromise.h" #include "mozilla/UniquePtr.h" +#include "mozilla/net/ContentRange.h" #include "mozilla/net/NeckoTargetHolder.h" #include "mozilla/net/PrivateBrowsingChannel.h" #include "nsHashPropertyBag.h" #include "nsIAsyncVerifyRedirectCallback.h" +#include "nsIBaseChannel.h" #include "nsIChannel.h" #include "nsIInterfaceRequestor.h" #include "nsILoadGroup.h" @@ -46,6 +49,7 @@ class nsICancelable; class nsBaseChannel : public nsHashPropertyBag, + public nsIBaseChannel, public nsIChannel, public nsIThreadRetargetableRequest, public nsIInterfaceRequestor, @@ -58,6 +62,7 @@ class nsBaseChannel NS_DECL_ISUPPORTS_INHERITED NS_DECL_NSIREQUEST NS_DECL_NSICHANNEL + NS_DECL_NSIBASECHANNEL NS_DECL_NSIINTERFACEREQUESTOR NS_DECL_NSITRANSPORTEVENTSINK NS_DECL_NSIASYNCVERIFYREDIRECTCALLBACK @@ -197,44 +202,6 @@ class nsBaseChannel return mPumpingData || mWaitingOnAsyncRedirect; } - // Blob requests may specify a range header. We must parse, validate, and - // store that info in a place where BlobURLInputStream::StoreBlobImplStream - // can access it. This class helps to encapsulate that logic. - class ContentRange { - private: - uint64_t mStart; - uint64_t mEnd; - uint64_t mSize; - - public: - uint64_t Start() const { return mStart; } - uint64_t End() const { return mEnd; } - uint64_t Size() const { return mSize; } - bool IsValid() const { return mStart < mSize; } - ContentRange() : mStart(0), mEnd(0), mSize(0) {} - ContentRange(uint64_t aStart, uint64_t aEnd, uint64_t aSize) - : mStart(aStart), mEnd(aEnd), mSize(aSize) {} - ContentRange(const nsACString& aRangeHeader, uint64_t aSize); - void AsHeader(nsACString& aOutString) const; - }; - - const mozilla::Maybe<ContentRange>& GetContentRange() const { - return mContentRange; - } - - void SetContentRange(uint64_t aStart, uint64_t aEnd, uint64_t aSize) { - mContentRange.emplace(ContentRange(aStart, aEnd, aSize)); - } - - bool SetContentRange(const nsACString& aRangeHeader, uint64_t aSize) { - auto range = ContentRange(aRangeHeader, aSize); - if (!range.IsValid()) { - return false; - } - mContentRange.emplace(range); - return true; - } - // Helper function for querying the channel's notification callbacks. template <class T> void GetCallback(nsCOMPtr<T>& result) { @@ -325,7 +292,8 @@ class nsBaseChannel bool mWaitingOnAsyncRedirect{false}; bool mOpenRedirectChannel{false}; uint32_t mRedirectFlags{0}; - mozilla::Maybe<ContentRange> mContentRange; + RefPtr<mozilla::net::ContentRange> mContentRange; + RefPtr<CMimeType> mFullMimeType; protected: nsCString mContentType; |