OLD | NEW |
(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 |
OLD | NEW |