diff options
author | Moonchild <moonchild@palemoon.org> | 2020-06-10 21:51:44 +0000 |
---|---|---|
committer | wolfbeast <mcwerewolf@wolfbeast.com> | 2020-06-13 11:51:41 +0200 |
commit | a04d67dd12d4999b28e74744150770482a3c5a3d (patch) | |
tree | dcbb29403e938f6b14140d15e9077c6188ca81c8 /dom/fetch/FetchDriver.h | |
parent | 9e2da53a02356244c5dc0a3e7b7ec916740d3d51 (diff) | |
download | UXP-a04d67dd12d4999b28e74744150770482a3c5a3d.tar UXP-a04d67dd12d4999b28e74744150770482a3c5a3d.tar.gz UXP-a04d67dd12d4999b28e74744150770482a3c5a3d.tar.lz UXP-a04d67dd12d4999b28e74744150770482a3c5a3d.tar.xz UXP-a04d67dd12d4999b28e74744150770482a3c5a3d.zip |
Issue #1587 - Part 3: Hook FetchSignal up to the Fetch API
Diffstat (limited to 'dom/fetch/FetchDriver.h')
-rw-r--r-- | dom/fetch/FetchDriver.h | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/dom/fetch/FetchDriver.h b/dom/fetch/FetchDriver.h index f74298a48..0ca9a34ee 100644 --- a/dom/fetch/FetchDriver.h +++ b/dom/fetch/FetchDriver.h @@ -12,6 +12,7 @@ #include "nsIStreamListener.h" #include "nsIThreadRetargetableStreamListener.h" #include "mozilla/ConsoleReportCollector.h" +#include "mozilla/dom/FetchSignal.h" #include "mozilla/dom/SRIMetadata.h" #include "mozilla/RefPtr.h" @@ -49,7 +50,14 @@ public: mGotResponseAvailable = true; OnResponseAvailableInternal(aResponse); } - virtual void OnResponseEnd() + + enum EndReason + { + eAborted, + eByNetworking, + }; + + virtual void OnResponseEnd(EndReason aReason) { }; nsIConsoleReportCollector* GetReporter() const @@ -58,6 +66,7 @@ public: } virtual void FlushConsoleReport() = 0; + protected: virtual ~FetchDriverObserver() { }; @@ -72,7 +81,8 @@ private: class FetchDriver final : public nsIStreamListener, public nsIChannelEventSink, public nsIInterfaceRequestor, - public nsIThreadRetargetableStreamListener + public nsIThreadRetargetableStreamListener, + public FetchSignal::Follower { public: NS_DECL_ISUPPORTS @@ -82,9 +92,12 @@ public: NS_DECL_NSIINTERFACEREQUESTOR NS_DECL_NSITHREADRETARGETABLESTREAMLISTENER - explicit FetchDriver(InternalRequest* aRequest, nsIPrincipal* aPrincipal, - nsILoadGroup* aLoadGroup); - NS_IMETHOD Fetch(FetchDriverObserver* aObserver); + FetchDriver(InternalRequest* aRequest, + nsIPrincipal* aPrincipal, + nsILoadGroup* aLoadGroup); + + nsresult Fetch(FetchSignal* aSignal, + FetchDriverObserver* aObserver); void SetDocument(nsIDocument* aDocument); @@ -96,6 +109,11 @@ public: mWorkerScript = aWorkerScirpt; } + // FetchSignal::Follower + + void + Aborted() override; + private: nsCOMPtr<nsIPrincipal> mPrincipal; nsCOMPtr<nsILoadGroup> mLoadGroup; @@ -104,6 +122,7 @@ private: nsCOMPtr<nsIOutputStream> mPipeOutputStream; RefPtr<FetchDriverObserver> mObserver; nsCOMPtr<nsIDocument> mDocument; + nsCOMPtr<nsIChannel> mChannel; nsAutoPtr<SRICheckDataVerifier> mSRIDataVerifier; SRIMetadata mSRIMetadata; nsCString mWorkerScript; |