summaryrefslogtreecommitdiffstats
path: root/dom/fetch/FetchDriver.h
diff options
context:
space:
mode:
authorMoonchild <moonchild@palemoon.org>2020-06-10 21:51:44 +0000
committerMoonchild <moonchild@palemoon.org>2020-06-10 21:51:44 +0000
commit1ca6039fb86cfab374fa0f4d37d9a084aa810f28 (patch)
tree36574bfa79ff61cecced5274339dee921ac7e77e /dom/fetch/FetchDriver.h
parentbe82b3331878fb2956d22d9bd3906fca3ab39751 (diff)
downloadUXP-1ca6039fb86cfab374fa0f4d37d9a084aa810f28.tar
UXP-1ca6039fb86cfab374fa0f4d37d9a084aa810f28.tar.gz
UXP-1ca6039fb86cfab374fa0f4d37d9a084aa810f28.tar.lz
UXP-1ca6039fb86cfab374fa0f4d37d9a084aa810f28.tar.xz
UXP-1ca6039fb86cfab374fa0f4d37d9a084aa810f28.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.h29
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;