| 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 #include "public/platform/modules/serviceworker/WebServiceWorkerRequest.h" | 67 #include "public/platform/modules/serviceworker/WebServiceWorkerRequest.h" |
| 68 #include "public/web/WebSerializedScriptValue.h" | 68 #include "public/web/WebSerializedScriptValue.h" |
| 69 #include "public/web/modules/serviceworker/WebServiceWorkerContextClient.h" | 69 #include "public/web/modules/serviceworker/WebServiceWorkerContextClient.h" |
| 70 #include "web/WebEmbeddedWorkerImpl.h" | 70 #include "web/WebEmbeddedWorkerImpl.h" |
| 71 #include "wtf/Assertions.h" | 71 #include "wtf/Assertions.h" |
| 72 #include "wtf/Functional.h" | 72 #include "wtf/Functional.h" |
| 73 #include "wtf/PassOwnPtr.h" | 73 #include "wtf/PassOwnPtr.h" |
| 74 | 74 |
| 75 namespace blink { | 75 namespace blink { |
| 76 | 76 |
| 77 PassOwnPtrWillBeRawPtr<ServiceWorkerGlobalScopeProxy> ServiceWorkerGlobalScopePr
oxy::create(WebEmbeddedWorkerImpl& embeddedWorker, Document& document, WebServic
eWorkerContextClient& client) | 77 RawPtr<ServiceWorkerGlobalScopeProxy> ServiceWorkerGlobalScopeProxy::create(WebE
mbeddedWorkerImpl& embeddedWorker, Document& document, WebServiceWorkerContextCl
ient& client) |
| 78 { | 78 { |
| 79 return adoptPtrWillBeNoop(new ServiceWorkerGlobalScopeProxy(embeddedWorker,
document, client)); | 79 return new ServiceWorkerGlobalScopeProxy(embeddedWorker, document, client); |
| 80 } | 80 } |
| 81 | 81 |
| 82 ServiceWorkerGlobalScopeProxy::~ServiceWorkerGlobalScopeProxy() | 82 ServiceWorkerGlobalScopeProxy::~ServiceWorkerGlobalScopeProxy() |
| 83 { | 83 { |
| 84 // Verify that the proxy has been detached. | 84 // Verify that the proxy has been detached. |
| 85 ASSERT(!m_embeddedWorker); | 85 ASSERT(!m_embeddedWorker); |
| 86 } | 86 } |
| 87 | 87 |
| 88 DEFINE_TRACE(ServiceWorkerGlobalScopeProxy) | 88 DEFINE_TRACE(ServiceWorkerGlobalScopeProxy) |
| 89 { | 89 { |
| 90 visitor->trace(m_document); | 90 visitor->trace(m_document); |
| 91 visitor->trace(m_workerGlobalScope); | 91 visitor->trace(m_workerGlobalScope); |
| 92 } | 92 } |
| 93 | 93 |
| 94 void ServiceWorkerGlobalScopeProxy::setRegistration(WebPassOwnPtr<WebServiceWork
erRegistration::Handle> handle) | 94 void ServiceWorkerGlobalScopeProxy::setRegistration(WebPassOwnPtr<WebServiceWork
erRegistration::Handle> handle) |
| 95 { | 95 { |
| 96 workerGlobalScope()->setRegistration(handle); | 96 workerGlobalScope()->setRegistration(handle); |
| 97 } | 97 } |
| 98 | 98 |
| 99 void ServiceWorkerGlobalScopeProxy::dispatchActivateEvent(int eventID) | 99 void ServiceWorkerGlobalScopeProxy::dispatchActivateEvent(int eventID) |
| 100 { | 100 { |
| 101 WaitUntilObserver* observer = WaitUntilObserver::create(workerGlobalScope(),
WaitUntilObserver::Activate, eventID); | 101 WaitUntilObserver* observer = WaitUntilObserver::create(workerGlobalScope(),
WaitUntilObserver::Activate, eventID); |
| 102 RefPtrWillBeRawPtr<Event> event(ExtendableEvent::create(EventTypeNames::acti
vate, ExtendableEventInit(), observer)); | 102 RawPtr<Event> event(ExtendableEvent::create(EventTypeNames::activate, Extend
ableEventInit(), observer)); |
| 103 workerGlobalScope()->dispatchExtendableEvent(event.release(), observer); | 103 workerGlobalScope()->dispatchExtendableEvent(event.release(), observer); |
| 104 } | 104 } |
| 105 | 105 |
| 106 void ServiceWorkerGlobalScopeProxy::dispatchExtendableMessageEvent(int eventID,
const WebString& message, const WebSecurityOrigin& sourceOrigin, const WebMessag
ePortChannelArray& webChannels, const WebServiceWorkerClientInfo& client) | 106 void ServiceWorkerGlobalScopeProxy::dispatchExtendableMessageEvent(int eventID,
const WebString& message, const WebSecurityOrigin& sourceOrigin, const WebMessag
ePortChannelArray& webChannels, const WebServiceWorkerClientInfo& client) |
| 107 { | 107 { |
| 108 ASSERT(RuntimeEnabledFeatures::serviceWorkerExtendableMessageEventEnabled())
; | 108 ASSERT(RuntimeEnabledFeatures::serviceWorkerExtendableMessageEventEnabled())
; |
| 109 | 109 |
| 110 WebSerializedScriptValue value = WebSerializedScriptValue::fromString(messag
e); | 110 WebSerializedScriptValue value = WebSerializedScriptValue::fromString(messag
e); |
| 111 MessagePortArray* ports = MessagePort::toMessagePortArray(m_workerGlobalScop
e, webChannels); | 111 MessagePortArray* ports = MessagePort::toMessagePortArray(m_workerGlobalScop
e, webChannels); |
| 112 String origin; | 112 String origin; |
| 113 if (!sourceOrigin.isUnique()) | 113 if (!sourceOrigin.isUnique()) |
| 114 origin = sourceOrigin.toString(); | 114 origin = sourceOrigin.toString(); |
| 115 ServiceWorkerClient* source = nullptr; | 115 ServiceWorkerClient* source = nullptr; |
| 116 if (client.clientType == WebServiceWorkerClientTypeWindow) | 116 if (client.clientType == WebServiceWorkerClientTypeWindow) |
| 117 source = ServiceWorkerWindowClient::create(client); | 117 source = ServiceWorkerWindowClient::create(client); |
| 118 else | 118 else |
| 119 source = ServiceWorkerClient::create(client); | 119 source = ServiceWorkerClient::create(client); |
| 120 WaitUntilObserver* observer = WaitUntilObserver::create(workerGlobalScope(),
WaitUntilObserver::Message, eventID); | 120 WaitUntilObserver* observer = WaitUntilObserver::create(workerGlobalScope(),
WaitUntilObserver::Message, eventID); |
| 121 | 121 |
| 122 RefPtrWillBeRawPtr<Event> event(ExtendableMessageEvent::create(value, origin
, ports, source, observer)); | 122 RawPtr<Event> event(ExtendableMessageEvent::create(value, origin, ports, sou
rce, observer)); |
| 123 workerGlobalScope()->dispatchExtendableEvent(event.release(), observer); | 123 workerGlobalScope()->dispatchExtendableEvent(event.release(), observer); |
| 124 } | 124 } |
| 125 | 125 |
| 126 void ServiceWorkerGlobalScopeProxy::dispatchExtendableMessageEvent(int eventID,
const WebString& message, const WebSecurityOrigin& sourceOrigin, const WebMessag
ePortChannelArray& webChannels, WebPassOwnPtr<WebServiceWorker::Handle> handle) | 126 void ServiceWorkerGlobalScopeProxy::dispatchExtendableMessageEvent(int eventID,
const WebString& message, const WebSecurityOrigin& sourceOrigin, const WebMessag
ePortChannelArray& webChannels, WebPassOwnPtr<WebServiceWorker::Handle> handle) |
| 127 { | 127 { |
| 128 ASSERT(RuntimeEnabledFeatures::serviceWorkerExtendableMessageEventEnabled())
; | 128 ASSERT(RuntimeEnabledFeatures::serviceWorkerExtendableMessageEventEnabled())
; |
| 129 | 129 |
| 130 WebSerializedScriptValue value = WebSerializedScriptValue::fromString(messag
e); | 130 WebSerializedScriptValue value = WebSerializedScriptValue::fromString(messag
e); |
| 131 MessagePortArray* ports = MessagePort::toMessagePortArray(m_workerGlobalScop
e, webChannels); | 131 MessagePortArray* ports = MessagePort::toMessagePortArray(m_workerGlobalScop
e, webChannels); |
| 132 String origin; | 132 String origin; |
| 133 if (!sourceOrigin.isUnique()) | 133 if (!sourceOrigin.isUnique()) |
| 134 origin = sourceOrigin.toString(); | 134 origin = sourceOrigin.toString(); |
| 135 ServiceWorker* source = ServiceWorker::from(m_workerGlobalScope->getExecutio
nContext(), handle.release()); | 135 ServiceWorker* source = ServiceWorker::from(m_workerGlobalScope->getExecutio
nContext(), handle.release()); |
| 136 WaitUntilObserver* observer = WaitUntilObserver::create(workerGlobalScope(),
WaitUntilObserver::Message, eventID); | 136 WaitUntilObserver* observer = WaitUntilObserver::create(workerGlobalScope(),
WaitUntilObserver::Message, eventID); |
| 137 | 137 |
| 138 RefPtrWillBeRawPtr<Event> event(ExtendableMessageEvent::create(value, origin
, ports, source, observer)); | 138 RawPtr<Event> event(ExtendableMessageEvent::create(value, origin, ports, sou
rce, observer)); |
| 139 workerGlobalScope()->dispatchExtendableEvent(event.release(), observer); | 139 workerGlobalScope()->dispatchExtendableEvent(event.release(), observer); |
| 140 } | 140 } |
| 141 | 141 |
| 142 void ServiceWorkerGlobalScopeProxy::dispatchFetchEvent(int eventID, const WebSer
viceWorkerRequest& webRequest) | 142 void ServiceWorkerGlobalScopeProxy::dispatchFetchEvent(int eventID, const WebSer
viceWorkerRequest& webRequest) |
| 143 { | 143 { |
| 144 dispatchFetchEventImpl(eventID, webRequest, EventTypeNames::fetch); | 144 dispatchFetchEventImpl(eventID, webRequest, EventTypeNames::fetch); |
| 145 } | 145 } |
| 146 | 146 |
| 147 void ServiceWorkerGlobalScopeProxy::dispatchForeignFetchEvent(int eventID, const
WebServiceWorkerRequest& webRequest) | 147 void ServiceWorkerGlobalScopeProxy::dispatchForeignFetchEvent(int eventID, const
WebServiceWorkerRequest& webRequest) |
| 148 { | 148 { |
| 149 dispatchFetchEventImpl(eventID, webRequest, EventTypeNames::foreignfetch); | 149 dispatchFetchEventImpl(eventID, webRequest, EventTypeNames::foreignfetch); |
| 150 } | 150 } |
| 151 | 151 |
| 152 void ServiceWorkerGlobalScopeProxy::dispatchGeofencingEvent(int eventID, WebGeof
encingEventType eventType, const WebString& regionID, const WebCircularGeofencin
gRegion& region) | 152 void ServiceWorkerGlobalScopeProxy::dispatchGeofencingEvent(int eventID, WebGeof
encingEventType eventType, const WebString& regionID, const WebCircularGeofencin
gRegion& region) |
| 153 { | 153 { |
| 154 const AtomicString& type = eventType == WebGeofencingEventTypeEnter ? EventT
ypeNames::geofenceenter : EventTypeNames::geofenceleave; | 154 const AtomicString& type = eventType == WebGeofencingEventTypeEnter ? EventT
ypeNames::geofenceenter : EventTypeNames::geofenceleave; |
| 155 workerGlobalScope()->dispatchEvent(GeofencingEvent::create(type, regionID, C
ircularGeofencingRegion::create(regionID, region))); | 155 workerGlobalScope()->dispatchEvent(GeofencingEvent::create(type, regionID, C
ircularGeofencingRegion::create(regionID, region))); |
| 156 } | 156 } |
| 157 | 157 |
| 158 void ServiceWorkerGlobalScopeProxy::dispatchInstallEvent(int eventID) | 158 void ServiceWorkerGlobalScopeProxy::dispatchInstallEvent(int eventID) |
| 159 { | 159 { |
| 160 WaitUntilObserver* observer = WaitUntilObserver::create(workerGlobalScope(),
WaitUntilObserver::Install, eventID); | 160 WaitUntilObserver* observer = WaitUntilObserver::create(workerGlobalScope(),
WaitUntilObserver::Install, eventID); |
| 161 RefPtrWillBeRawPtr<Event> event; | 161 RawPtr<Event> event; |
| 162 if (RuntimeEnabledFeatures::foreignFetchEnabled()) | 162 if (RuntimeEnabledFeatures::foreignFetchEnabled()) |
| 163 event = InstallEvent::create(EventTypeNames::install, ExtendableEventIni
t(), observer); | 163 event = InstallEvent::create(EventTypeNames::install, ExtendableEventIni
t(), observer); |
| 164 else | 164 else |
| 165 event = ExtendableEvent::create(EventTypeNames::install, ExtendableEvent
Init(), observer); | 165 event = ExtendableEvent::create(EventTypeNames::install, ExtendableEvent
Init(), observer); |
| 166 workerGlobalScope()->dispatchExtendableEvent(event.release(), observer); | 166 workerGlobalScope()->dispatchExtendableEvent(event.release(), observer); |
| 167 } | 167 } |
| 168 | 168 |
| 169 void ServiceWorkerGlobalScopeProxy::dispatchMessageEvent(const WebString& messag
e, const WebMessagePortChannelArray& webChannels) | 169 void ServiceWorkerGlobalScopeProxy::dispatchMessageEvent(const WebString& messag
e, const WebMessagePortChannelArray& webChannels) |
| 170 { | 170 { |
| 171 MessagePortArray* ports = MessagePort::toMessagePortArray(workerGlobalScope(
), webChannels); | 171 MessagePortArray* ports = MessagePort::toMessagePortArray(workerGlobalScope(
), webChannels); |
| 172 WebSerializedScriptValue value = WebSerializedScriptValue::fromString(messag
e); | 172 WebSerializedScriptValue value = WebSerializedScriptValue::fromString(messag
e); |
| 173 workerGlobalScope()->dispatchEvent(MessageEvent::create(ports, value)); | 173 workerGlobalScope()->dispatchEvent(MessageEvent::create(ports, value)); |
| 174 } | 174 } |
| 175 | 175 |
| 176 void ServiceWorkerGlobalScopeProxy::dispatchNotificationClickEvent(int eventID,
int64_t notificationID, const WebNotificationData& data, int actionIndex) | 176 void ServiceWorkerGlobalScopeProxy::dispatchNotificationClickEvent(int eventID,
int64_t notificationID, const WebNotificationData& data, int actionIndex) |
| 177 { | 177 { |
| 178 WaitUntilObserver* observer = WaitUntilObserver::create(workerGlobalScope(),
WaitUntilObserver::NotificationClick, eventID); | 178 WaitUntilObserver* observer = WaitUntilObserver::create(workerGlobalScope(),
WaitUntilObserver::NotificationClick, eventID); |
| 179 NotificationEventInit eventInit; | 179 NotificationEventInit eventInit; |
| 180 eventInit.setNotification(Notification::create(workerGlobalScope(), notifica
tionID, data, true /* showing */)); | 180 eventInit.setNotification(Notification::create(workerGlobalScope(), notifica
tionID, data, true /* showing */)); |
| 181 if (0 <= actionIndex && actionIndex < static_cast<int>(data.actions.size())) | 181 if (0 <= actionIndex && actionIndex < static_cast<int>(data.actions.size())) |
| 182 eventInit.setAction(data.actions[actionIndex].action); | 182 eventInit.setAction(data.actions[actionIndex].action); |
| 183 RefPtrWillBeRawPtr<Event> event(NotificationEvent::create(EventTypeNames::no
tificationclick, eventInit, observer)); | 183 RawPtr<Event> event(NotificationEvent::create(EventTypeNames::notificationcl
ick, eventInit, observer)); |
| 184 workerGlobalScope()->dispatchExtendableEvent(event.release(), observer); | 184 workerGlobalScope()->dispatchExtendableEvent(event.release(), observer); |
| 185 } | 185 } |
| 186 | 186 |
| 187 void ServiceWorkerGlobalScopeProxy::dispatchNotificationCloseEvent(int eventID,
int64_t notificationID, const WebNotificationData& data) | 187 void ServiceWorkerGlobalScopeProxy::dispatchNotificationCloseEvent(int eventID,
int64_t notificationID, const WebNotificationData& data) |
| 188 { | 188 { |
| 189 WaitUntilObserver* observer = WaitUntilObserver::create(workerGlobalScope(),
WaitUntilObserver::NotificationClose, eventID); | 189 WaitUntilObserver* observer = WaitUntilObserver::create(workerGlobalScope(),
WaitUntilObserver::NotificationClose, eventID); |
| 190 NotificationEventInit eventInit; | 190 NotificationEventInit eventInit; |
| 191 eventInit.setAction(WTF::String()); // initialize as null. | 191 eventInit.setAction(WTF::String()); // initialize as null. |
| 192 eventInit.setNotification(Notification::create(workerGlobalScope(), notifica
tionID, data, false /* showing */)); | 192 eventInit.setNotification(Notification::create(workerGlobalScope(), notifica
tionID, data, false /* showing */)); |
| 193 RefPtrWillBeRawPtr<Event> event(NotificationEvent::create(EventTypeNames::no
tificationclose, eventInit, observer)); | 193 RawPtr<Event> event(NotificationEvent::create(EventTypeNames::notificationcl
ose, eventInit, observer)); |
| 194 workerGlobalScope()->dispatchExtendableEvent(event.release(), observer); | 194 workerGlobalScope()->dispatchExtendableEvent(event.release(), observer); |
| 195 } | 195 } |
| 196 | 196 |
| 197 void ServiceWorkerGlobalScopeProxy::dispatchPushEvent(int eventID, const WebStri
ng& data) | 197 void ServiceWorkerGlobalScopeProxy::dispatchPushEvent(int eventID, const WebStri
ng& data) |
| 198 { | 198 { |
| 199 WaitUntilObserver* observer = WaitUntilObserver::create(workerGlobalScope(),
WaitUntilObserver::Push, eventID); | 199 WaitUntilObserver* observer = WaitUntilObserver::create(workerGlobalScope(),
WaitUntilObserver::Push, eventID); |
| 200 RefPtrWillBeRawPtr<Event> event(PushEvent::create(EventTypeNames::push, Push
MessageData::create(data), observer)); | 200 RawPtr<Event> event(PushEvent::create(EventTypeNames::push, PushMessageData:
:create(data), observer)); |
| 201 workerGlobalScope()->dispatchExtendableEvent(event.release(), observer); | 201 workerGlobalScope()->dispatchExtendableEvent(event.release(), observer); |
| 202 } | 202 } |
| 203 | 203 |
| 204 void ServiceWorkerGlobalScopeProxy::dispatchServicePortConnectEvent(WebServicePo
rtConnectEventCallbacks* rawCallbacks, const WebURL& targetURL, const WebString&
origin, WebServicePortID portID) | 204 void ServiceWorkerGlobalScopeProxy::dispatchServicePortConnectEvent(WebServicePo
rtConnectEventCallbacks* rawCallbacks, const WebURL& targetURL, const WebString&
origin, WebServicePortID portID) |
| 205 { | 205 { |
| 206 OwnPtr<WebServicePortConnectEventCallbacks> callbacks = adoptPtr(rawCallback
s); | 206 OwnPtr<WebServicePortConnectEventCallbacks> callbacks = adoptPtr(rawCallback
s); |
| 207 ServicePortCollection* collection = WorkerNavigatorServices::services(worker
GlobalScope(), *workerGlobalScope()->navigator()); | 207 ServicePortCollection* collection = WorkerNavigatorServices::services(worker
GlobalScope(), *workerGlobalScope()->navigator()); |
| 208 collection->dispatchConnectEvent(callbacks.release(), targetURL, origin, por
tID); | 208 collection->dispatchConnectEvent(callbacks.release(), targetURL, origin, por
tID); |
| 209 } | 209 } |
| 210 | 210 |
| 211 void ServiceWorkerGlobalScopeProxy::dispatchSyncEvent(int eventID, const WebStri
ng& tag, LastChanceOption lastChance) | 211 void ServiceWorkerGlobalScopeProxy::dispatchSyncEvent(int eventID, const WebStri
ng& tag, LastChanceOption lastChance) |
| 212 { | 212 { |
| 213 if (!RuntimeEnabledFeatures::backgroundSyncEnabled()) { | 213 if (!RuntimeEnabledFeatures::backgroundSyncEnabled()) { |
| 214 ServiceWorkerGlobalScopeClient::from(workerGlobalScope())->didHandleSync
Event(eventID, WebServiceWorkerEventResultCompleted); | 214 ServiceWorkerGlobalScopeClient::from(workerGlobalScope())->didHandleSync
Event(eventID, WebServiceWorkerEventResultCompleted); |
| 215 return; | 215 return; |
| 216 } | 216 } |
| 217 WaitUntilObserver* observer = WaitUntilObserver::create(workerGlobalScope(),
WaitUntilObserver::Sync, eventID); | 217 WaitUntilObserver* observer = WaitUntilObserver::create(workerGlobalScope(),
WaitUntilObserver::Sync, eventID); |
| 218 RefPtrWillBeRawPtr<Event> event(SyncEvent::create(EventTypeNames::sync, tag,
lastChance == IsLastChance, observer)); | 218 RawPtr<Event> event(SyncEvent::create(EventTypeNames::sync, tag, lastChance
== IsLastChance, observer)); |
| 219 workerGlobalScope()->dispatchExtendableEvent(event.release(), observer); | 219 workerGlobalScope()->dispatchExtendableEvent(event.release(), observer); |
| 220 } | 220 } |
| 221 | 221 |
| 222 void ServiceWorkerGlobalScopeProxy::dispatchCrossOriginMessageEvent(const WebCro
ssOriginServiceWorkerClient& webClient, const WebString& message, const WebMessa
gePortChannelArray& webChannels) | 222 void ServiceWorkerGlobalScopeProxy::dispatchCrossOriginMessageEvent(const WebCro
ssOriginServiceWorkerClient& webClient, const WebString& message, const WebMessa
gePortChannelArray& webChannels) |
| 223 { | 223 { |
| 224 MessagePortArray* ports = MessagePort::toMessagePortArray(workerGlobalScope(
), webChannels); | 224 MessagePortArray* ports = MessagePort::toMessagePortArray(workerGlobalScope(
), webChannels); |
| 225 WebSerializedScriptValue value = WebSerializedScriptValue::fromString(messag
e); | 225 WebSerializedScriptValue value = WebSerializedScriptValue::fromString(messag
e); |
| 226 // FIXME: Have proper source for this MessageEvent. | 226 // FIXME: Have proper source for this MessageEvent. |
| 227 RefPtrWillBeRawPtr<MessageEvent> event = MessageEvent::create(ports, value,
webClient.origin.string()); | 227 RawPtr<MessageEvent> event = MessageEvent::create(ports, value, webClient.or
igin.string()); |
| 228 event->setType(EventTypeNames::crossoriginmessage); | 228 event->setType(EventTypeNames::crossoriginmessage); |
| 229 workerGlobalScope()->dispatchEvent(event); | 229 workerGlobalScope()->dispatchEvent(event); |
| 230 } | 230 } |
| 231 | 231 |
| 232 void ServiceWorkerGlobalScopeProxy::reportException(const String& errorMessage,
int lineNumber, int columnNumber, const String& sourceURL, int) | 232 void ServiceWorkerGlobalScopeProxy::reportException(const String& errorMessage,
int lineNumber, int columnNumber, const String& sourceURL, int) |
| 233 { | 233 { |
| 234 client().reportException(errorMessage, lineNumber, columnNumber, sourceURL); | 234 client().reportException(errorMessage, lineNumber, columnNumber, sourceURL); |
| 235 } | 235 } |
| 236 | 236 |
| 237 void ServiceWorkerGlobalScopeProxy::reportConsoleMessage(PassRefPtrWillBeRawPtr<
ConsoleMessage> consoleMessage) | 237 void ServiceWorkerGlobalScopeProxy::reportConsoleMessage(RawPtr<ConsoleMessage>
consoleMessage) |
| 238 { | 238 { |
| 239 client().reportConsoleMessage(consoleMessage->source(), consoleMessage->leve
l(), consoleMessage->message(), consoleMessage->lineNumber(), consoleMessage->ur
l()); | 239 client().reportConsoleMessage(consoleMessage->source(), consoleMessage->leve
l(), consoleMessage->message(), consoleMessage->lineNumber(), consoleMessage->ur
l()); |
| 240 } | 240 } |
| 241 | 241 |
| 242 void ServiceWorkerGlobalScopeProxy::postMessageToPageInspector(const String& mes
sage) | 242 void ServiceWorkerGlobalScopeProxy::postMessageToPageInspector(const String& mes
sage) |
| 243 { | 243 { |
| 244 ASSERT(m_embeddedWorker); | 244 ASSERT(m_embeddedWorker); |
| 245 document().postInspectorTask(BLINK_FROM_HERE, createCrossThreadTask(&WebEmbe
ddedWorkerImpl::postMessageToPageInspector, m_embeddedWorker, message)); | 245 document().postInspectorTask(BLINK_FROM_HERE, createCrossThreadTask(&WebEmbe
ddedWorkerImpl::postMessageToPageInspector, m_embeddedWorker, message)); |
| 246 } | 246 } |
| 247 | 247 |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 318 void ServiceWorkerGlobalScopeProxy::dispatchFetchEventImpl(int eventID, const We
bServiceWorkerRequest& webRequest, const AtomicString& eventTypeName) | 318 void ServiceWorkerGlobalScopeProxy::dispatchFetchEventImpl(int eventID, const We
bServiceWorkerRequest& webRequest, const AtomicString& eventTypeName) |
| 319 { | 319 { |
| 320 RespondWithObserver* observer = RespondWithObserver::create(workerGlobalScop
e(), eventID, webRequest.url(), webRequest.mode(), webRequest.frameType(), webRe
quest.requestContext()); | 320 RespondWithObserver* observer = RespondWithObserver::create(workerGlobalScop
e(), eventID, webRequest.url(), webRequest.mode(), webRequest.frameType(), webRe
quest.requestContext()); |
| 321 Request* request = Request::create(workerGlobalScope(), webRequest); | 321 Request* request = Request::create(workerGlobalScope(), webRequest); |
| 322 request->getHeaders()->setGuard(Headers::ImmutableGuard); | 322 request->getHeaders()->setGuard(Headers::ImmutableGuard); |
| 323 FetchEventInit eventInit; | 323 FetchEventInit eventInit; |
| 324 eventInit.setCancelable(true); | 324 eventInit.setCancelable(true); |
| 325 eventInit.setRequest(request); | 325 eventInit.setRequest(request); |
| 326 eventInit.setClientId(webRequest.isMainResourceLoad() ? WebString() : webReq
uest.clientId()); | 326 eventInit.setClientId(webRequest.isMainResourceLoad() ? WebString() : webReq
uest.clientId()); |
| 327 eventInit.setIsReload(webRequest.isReload()); | 327 eventInit.setIsReload(webRequest.isReload()); |
| 328 RefPtrWillBeRawPtr<FetchEvent> fetchEvent(FetchEvent::create(eventTypeName,
eventInit, observer)); | 328 RawPtr<FetchEvent> fetchEvent(FetchEvent::create(eventTypeName, eventInit, o
bserver)); |
| 329 DispatchEventResult dispatchResult = workerGlobalScope()->dispatchEvent(fetc
hEvent.release()); | 329 DispatchEventResult dispatchResult = workerGlobalScope()->dispatchEvent(fetc
hEvent.release()); |
| 330 observer->didDispatchEvent(dispatchResult); | 330 observer->didDispatchEvent(dispatchResult); |
| 331 } | 331 } |
| 332 | 332 |
| 333 } // namespace blink | 333 } // namespace blink |
| OLD | NEW |