| OLD | NEW |
| 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, WaitUntilObser
ver* observer) | 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, observer); | 14 return new ForeignFetchRespondWithObserver(context, eventID, requestURL, req
uestMode, frameType, requestContext, std::move(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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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, WaitUntilObserver* obs
erver) | 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, observer) | 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 |
| OLD | NEW |