| Index: third_party/WebKit/Source/modules/serviceworkers/RespondWithObserver.h
|
| diff --git a/third_party/WebKit/Source/modules/serviceworkers/RespondWithObserver.h b/third_party/WebKit/Source/modules/serviceworkers/RespondWithObserver.h
|
| index b87cd8b0deabaf7b313fc0768e532ea82392b94c..3f9cd401865dd7e70138514f6a989db5a3acae21 100644
|
| --- a/third_party/WebKit/Source/modules/serviceworkers/RespondWithObserver.h
|
| +++ b/third_party/WebKit/Source/modules/serviceworkers/RespondWithObserver.h
|
| @@ -8,6 +8,7 @@
|
| #include "core/dom/ContextLifecycleObserver.h"
|
| #include "core/events/EventTarget.h"
|
| #include "modules/ModulesExport.h"
|
| +#include "modules/serviceworkers/WaitUntilObserver.h"
|
| #include "platform/heap/Handle.h"
|
| #include "public/platform/WebURLRequest.h"
|
| #include "public/platform/modules/serviceworker/WebServiceWorkerResponseError.h"
|
| @@ -27,7 +28,7 @@ class MODULES_EXPORT RespondWithObserver : public GarbageCollectedFinalized<Resp
|
| public:
|
| virtual ~RespondWithObserver();
|
|
|
| - static RespondWithObserver* create(ExecutionContext*, int eventID, const KURL& requestURL, WebURLRequest::FetchRequestMode, WebURLRequest::FrameType, WebURLRequest::RequestContext);
|
| + static RespondWithObserver* create(ExecutionContext*, int eventID, const KURL& requestURL, WebURLRequest::FetchRequestMode, WebURLRequest::FrameType, WebURLRequest::RequestContext, WaitUntilObserver*);
|
|
|
| void contextDestroyed() override;
|
|
|
| @@ -43,7 +44,7 @@ public:
|
| DECLARE_VIRTUAL_TRACE();
|
|
|
| protected:
|
| - RespondWithObserver(ExecutionContext*, int eventID, const KURL& requestURL, WebURLRequest::FetchRequestMode, WebURLRequest::FrameType, WebURLRequest::RequestContext);
|
| + RespondWithObserver(ExecutionContext*, int eventID, const KURL& requestURL, WebURLRequest::FetchRequestMode, WebURLRequest::FrameType, WebURLRequest::RequestContext, WaitUntilObserver*);
|
|
|
| private:
|
| class ThenFunction;
|
| @@ -56,6 +57,13 @@ private:
|
|
|
| enum State { Initial, Pending, Done };
|
| State m_state;
|
| +
|
| + // RespondWith should ensure the ExtendableEvent is alive until the promise
|
| + // passed to RespondWith is resolved. The lifecycle of the ExtendableEvent
|
| + // is controlled by WaitUntilObserver, so not only
|
| + // WaitUntilObserver::ThenFunction but RespondWith needs to have a strong
|
| + // reference to the WaitUntilObserver.
|
| + Member<WaitUntilObserver> m_observer;
|
| };
|
|
|
| } // namespace blink
|
|
|