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

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

Issue 1845463002: Start implementing ForeignFetchEvent for foreign fetch events. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 8 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "modules/serviceworkers/ForeignFetchRespondWithObserver.h"
6
7 #include "modules/serviceworkers/ForeignFetchResponse.h"
8
9 namespace blink {
10
11 ForeignFetchRespondWithObserver* ForeignFetchRespondWithObserver::create(Executi onContext* context, int eventID, const KURL& requestURL, WebURLRequest::FetchReq uestMode requestMode, WebURLRequest::FrameType frameType, WebURLRequest::Request Context requestContext)
12 {
13 return new ForeignFetchRespondWithObserver(context, eventID, requestURL, req uestMode, frameType, requestContext);
14 }
15
16 void ForeignFetchRespondWithObserver::responseWasFulfilled(const ScriptValue& va lue)
17 {
18 ASSERT(getExecutionContext());
19 TrackExceptionState exceptionState;
20 ForeignFetchResponse foreignFetchResponse = ScriptValue::to<ForeignFetchResp onse>(toIsolate(getExecutionContext()), value, exceptionState);
21 if (exceptionState.hadException()) {
22 responseWasRejected(WebServiceWorkerResponseErrorNoForeignFetchResponse) ;
23 return;
24 }
25
26 // TODO(mek): Handle foreign fetch specific response parameters.
27 Response* response = foreignFetchResponse.response();
28 RespondWithObserver::responseWasFulfilled(ScriptValue::from(value.getScriptS tate(), response));
29 }
30
31 ForeignFetchRespondWithObserver::ForeignFetchRespondWithObserver(ExecutionContex t* context, int eventID, const KURL& requestURL, WebURLRequest::FetchRequestMode requestMode, WebURLRequest::FrameType frameType, WebURLRequest::RequestContext requestContext)
32 : RespondWithObserver(context, eventID, requestURL, requestMode, frameType, requestContext)
33 {
34 }
35
36 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698