| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 void ServiceWorkerGlobalScopeProxy::dispatchFetchEvent(int eventID, const WebSer
viceWorkerRequest& webRequest) | 134 void ServiceWorkerGlobalScopeProxy::dispatchFetchEvent(int eventID, const WebSer
viceWorkerRequest& webRequest) |
| 135 { | 135 { |
| 136 RespondWithObserver* observer = RespondWithObserver::create(workerGlobalScop
e(), eventID, webRequest.url(), webRequest.mode(), webRequest.frameType(), webRe
quest.requestContext()); | 136 RespondWithObserver* observer = RespondWithObserver::create(workerGlobalScop
e(), eventID, webRequest.url(), webRequest.mode(), webRequest.frameType(), webRe
quest.requestContext()); |
| 137 Request* request = Request::create(workerGlobalScope()->scriptController()->
getScriptState(), webRequest); | 137 Request* request = Request::create(workerGlobalScope()->scriptController()->
getScriptState(), webRequest); |
| 138 request->getHeaders()->setGuard(Headers::ImmutableGuard); | 138 request->getHeaders()->setGuard(Headers::ImmutableGuard); |
| 139 FetchEventInit eventInit; | 139 FetchEventInit eventInit; |
| 140 eventInit.setCancelable(true); | 140 eventInit.setCancelable(true); |
| 141 eventInit.setRequest(request); | 141 eventInit.setRequest(request); |
| 142 eventInit.setClientId(webRequest.isMainResourceLoad() ? WebString() : webReq
uest.clientId()); | 142 eventInit.setClientId(webRequest.isMainResourceLoad() ? WebString() : webReq
uest.clientId()); |
| 143 eventInit.setIsReload(webRequest.isReload()); | 143 eventInit.setIsReload(webRequest.isReload()); |
| 144 FetchEvent* fetchEvent = FetchEvent::create(EventTypeNames::fetch, eventInit
, observer); | 144 FetchEvent* fetchEvent = FetchEvent::create(workerGlobalScope()->scriptContr
oller()->getScriptState(), EventTypeNames::fetch, eventInit, observer); |
| 145 DispatchEventResult dispatchResult = workerGlobalScope()->dispatchEvent(fetc
hEvent); | 145 DispatchEventResult dispatchResult = workerGlobalScope()->dispatchEvent(fetc
hEvent); |
| 146 observer->didDispatchEvent(dispatchResult); | 146 observer->didDispatchEvent(dispatchResult); |
| 147 } | 147 } |
| 148 | 148 |
| 149 void ServiceWorkerGlobalScopeProxy::dispatchForeignFetchEvent(int eventID, const
WebServiceWorkerRequest& webRequest) | 149 void ServiceWorkerGlobalScopeProxy::dispatchForeignFetchEvent(int eventID, const
WebServiceWorkerRequest& webRequest) |
| 150 { | 150 { |
| 151 RefPtr<SecurityOrigin> origin = SecurityOrigin::create(webRequest.referrerUr
l()); | 151 RefPtr<SecurityOrigin> origin = SecurityOrigin::create(webRequest.referrerUr
l()); |
| 152 ForeignFetchRespondWithObserver* observer = ForeignFetchRespondWithObserver:
:create(workerGlobalScope(), eventID, webRequest.url(), webRequest.mode(), webRe
quest.frameType(), webRequest.requestContext(), origin); | 152 ForeignFetchRespondWithObserver* observer = ForeignFetchRespondWithObserver:
:create(workerGlobalScope(), eventID, webRequest.url(), webRequest.mode(), webRe
quest.frameType(), webRequest.requestContext(), origin); |
| 153 Request* request = Request::create(workerGlobalScope()->scriptController()->
getScriptState(), webRequest); | 153 Request* request = Request::create(workerGlobalScope()->scriptController()->
getScriptState(), webRequest); |
| 154 request->getHeaders()->setGuard(Headers::ImmutableGuard); | 154 request->getHeaders()->setGuard(Headers::ImmutableGuard); |
| 155 ForeignFetchEventInit eventInit; | 155 ForeignFetchEventInit eventInit; |
| 156 eventInit.setCancelable(true); | 156 eventInit.setCancelable(true); |
| 157 eventInit.setRequest(request); | 157 eventInit.setRequest(request); |
| 158 eventInit.setOrigin(origin->toString()); | 158 eventInit.setOrigin(origin->toString()); |
| 159 ForeignFetchEvent* fetchEvent = ForeignFetchEvent::create(EventTypeNames::fo
reignfetch, eventInit, observer); | 159 ForeignFetchEvent* fetchEvent = ForeignFetchEvent::create(workerGlobalScope(
)->scriptController()->getScriptState(), EventTypeNames::foreignfetch, eventInit
, observer); |
| 160 DispatchEventResult dispatchResult = workerGlobalScope()->dispatchEvent(fetc
hEvent); | 160 DispatchEventResult dispatchResult = workerGlobalScope()->dispatchEvent(fetc
hEvent); |
| 161 observer->didDispatchEvent(dispatchResult); | 161 observer->didDispatchEvent(dispatchResult); |
| 162 } | 162 } |
| 163 | 163 |
| 164 void ServiceWorkerGlobalScopeProxy::dispatchInstallEvent(int eventID) | 164 void ServiceWorkerGlobalScopeProxy::dispatchInstallEvent(int eventID) |
| 165 { | 165 { |
| 166 WaitUntilObserver* observer = WaitUntilObserver::create(workerGlobalScope(),
WaitUntilObserver::Install, eventID); | 166 WaitUntilObserver* observer = WaitUntilObserver::create(workerGlobalScope(),
WaitUntilObserver::Install, eventID); |
| 167 Event* event; | 167 Event* event; |
| 168 if (RuntimeEnabledFeatures::foreignFetchEnabled()) | 168 if (RuntimeEnabledFeatures::foreignFetchEnabled()) |
| 169 event = InstallEvent::create(EventTypeNames::install, ExtendableEventIni
t(), observer); | 169 event = InstallEvent::create(EventTypeNames::install, ExtendableEventIni
t(), observer); |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 return *m_document; | 298 return *m_document; |
| 299 } | 299 } |
| 300 | 300 |
| 301 ServiceWorkerGlobalScope* ServiceWorkerGlobalScopeProxy::workerGlobalScope() con
st | 301 ServiceWorkerGlobalScope* ServiceWorkerGlobalScopeProxy::workerGlobalScope() con
st |
| 302 { | 302 { |
| 303 DCHECK(m_workerGlobalScope); | 303 DCHECK(m_workerGlobalScope); |
| 304 return m_workerGlobalScope; | 304 return m_workerGlobalScope; |
| 305 } | 305 } |
| 306 | 306 |
| 307 } // namespace blink | 307 } // namespace blink |
| OLD | NEW |