Issue #1587 - Part 5: Hook FetchObserver up to the Fetch API

This commit is contained in:
Moonchild 2020-06-11 08:51:07 +00:00 committed by Roy Tam
commit 3d2ca85edd
11 changed files with 399 additions and 75 deletions

View file

@ -9,11 +9,13 @@
#include "mozilla/DOMEventTargetHelper.h"
#include "mozilla/dom/FetchObserverBinding.h"
#include "mozilla/dom/FetchSignal.h"
namespace mozilla {
namespace dom {
class FetchObserver final : public DOMEventTargetHelper
, public FetchSignal::Follower
{
public:
NS_DECL_ISUPPORTS_INHERITED
@ -22,7 +24,7 @@ public:
static bool
IsEnabled(JSContext* aCx, JSObject* aGlobal);
FetchObserver(nsIGlobalObject* aGlobal, FetchState aState);
FetchObserver(nsIGlobalObject* aGlobal, FetchSignal* aSignal);
JSObject*
WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
@ -34,6 +36,12 @@ public:
IMPL_EVENT_HANDLER(requestprogress);
IMPL_EVENT_HANDLER(responseprogress);
void
Aborted() override;
void
SetState(FetchState aState);
private:
~FetchObserver() = default;