Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(484)

Side by Side Diff: third_party/WebKit/Source/modules/serviceworkers/ForeignFetchRespondWithObserver.cpp

Issue 2034663002: ServiceWorker: Keep the worker alive until FetchEvent.waitUntil settles (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "modules/serviceworkers/ForeignFetchRespondWithObserver.h" 5 #include "modules/serviceworkers/ForeignFetchRespondWithObserver.h"
6 6
7 #include "core/fetch/CrossOriginAccessControl.h" 7 #include "core/fetch/CrossOriginAccessControl.h"
8 #include "modules/serviceworkers/ForeignFetchResponse.h" 8 #include "modules/serviceworkers/ForeignFetchResponse.h"
9 9
10 namespace blink { 10 namespace blink {
11 11
12 ForeignFetchRespondWithObserver* ForeignFetchRespondWithObserver::create(Executi onContext* context, int eventID, const KURL& requestURL, WebURLRequest::FetchReq uestMode requestMode, WebURLRequest::FrameType frameType, WebURLRequest::Request Context requestContext, PassRefPtr<SecurityOrigin> requestOrigin) 12 ForeignFetchRespondWithObserver* ForeignFetchRespondWithObserver::create(Executi onContext* context, int eventID, const KURL& requestURL, WebURLRequest::FetchReq uestMode requestMode, WebURLRequest::FrameType frameType, WebURLRequest::Request Context requestContext, PassRefPtr<SecurityOrigin> requestOrigin, WaitUntilObser ver* observer)
13 { 13 {
14 return new ForeignFetchRespondWithObserver(context, eventID, requestURL, req uestMode, frameType, requestContext, requestOrigin); 14 return new ForeignFetchRespondWithObserver(context, eventID, requestURL, req uestMode, frameType, requestContext, requestOrigin, observer);
15 } 15 }
16 16
17 void ForeignFetchRespondWithObserver::responseWasFulfilled(const ScriptValue& va lue) 17 void ForeignFetchRespondWithObserver::responseWasFulfilled(const ScriptValue& va lue)
18 { 18 {
19 ASSERT(getExecutionContext()); 19 ASSERT(getExecutionContext());
20 TrackExceptionState exceptionState; 20 TrackExceptionState exceptionState;
21 ForeignFetchResponse foreignFetchResponse = ScriptValue::to<ForeignFetchResp onse>(toIsolate(getExecutionContext()), value, exceptionState); 21 ForeignFetchResponse foreignFetchResponse = ScriptValue::to<ForeignFetchResp onse>(toIsolate(getExecutionContext()), value, exceptionState);
22 if (exceptionState.hadException()) { 22 if (exceptionState.hadException()) {
23 responseWasRejected(WebServiceWorkerResponseErrorNoForeignFetchResponse) ; 23 responseWasRejected(WebServiceWorkerResponseErrorNoForeignFetchResponse) ;
24 return; 24 return;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 headers.removeAll(headersToRemove); 59 headers.removeAll(headersToRemove);
60 } 60 }
61 } 61 }
62 FetchResponseData* responseData = internalResponse->createCORSFilteredRe sponse(headers); 62 FetchResponseData* responseData = internalResponse->createCORSFilteredRe sponse(headers);
63 response = Response::create(getExecutionContext(), responseData); 63 response = Response::create(getExecutionContext(), responseData);
64 } 64 }
65 65
66 RespondWithObserver::responseWasFulfilled(ScriptValue::from(value.getScriptS tate(), response)); 66 RespondWithObserver::responseWasFulfilled(ScriptValue::from(value.getScriptS tate(), response));
67 } 67 }
68 68
69 ForeignFetchRespondWithObserver::ForeignFetchRespondWithObserver(ExecutionContex t* context, int eventID, const KURL& requestURL, WebURLRequest::FetchRequestMode requestMode, WebURLRequest::FrameType frameType, WebURLRequest::RequestContext requestContext, PassRefPtr<SecurityOrigin> requestOrigin) 69 ForeignFetchRespondWithObserver::ForeignFetchRespondWithObserver(ExecutionContex t* context, int eventID, const KURL& requestURL, WebURLRequest::FetchRequestMode requestMode, WebURLRequest::FrameType frameType, WebURLRequest::RequestContext requestContext, PassRefPtr<SecurityOrigin> requestOrigin, WaitUntilObserver* obs erver)
70 : RespondWithObserver(context, eventID, requestURL, requestMode, frameType, requestContext) 70 : RespondWithObserver(context, eventID, requestURL, requestMode, frameType, requestContext, observer)
71 , m_requestOrigin(requestOrigin) 71 , m_requestOrigin(requestOrigin)
72 { 72 {
73 } 73 }
74 74
75 } // namespace blink 75 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698