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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 resolver->reject(DOMException::create(SecurityError, "Can only unregiste
r for patterns in the document's origin.")); | 135 resolver->reject(DOMException::create(SecurityError, "Can only unregiste
r for patterns in the document's origin.")); |
136 return promise; | 136 return promise; |
137 } | 137 } |
138 | 138 |
139 m_provider->unregisterServiceWorker(patternURL, new CallbackPromiseAdapter<U
ndefinedValue, ServiceWorkerError>(resolver)); | 139 m_provider->unregisterServiceWorker(patternURL, new CallbackPromiseAdapter<U
ndefinedValue, ServiceWorkerError>(resolver)); |
140 return promise; | 140 return promise; |
141 } | 141 } |
142 | 142 |
143 void ServiceWorkerContainer::setCurrentServiceWorker(blink::WebServiceWorker* se
rviceWorker) | 143 void ServiceWorkerContainer::setCurrentServiceWorker(blink::WebServiceWorker* se
rviceWorker) |
144 { | 144 { |
145 if (!executionContext()) | 145 if (!executionContext()) { |
| 146 delete serviceWorker; |
146 return; | 147 return; |
| 148 } |
147 m_current = ServiceWorker::create(executionContext(), adoptPtr(serviceWorker
)); | 149 m_current = ServiceWorker::create(executionContext(), adoptPtr(serviceWorker
)); |
148 } | 150 } |
149 | 151 |
150 void ServiceWorkerContainer::dispatchMessageEvent(const blink::WebString& messag
e, const blink::WebMessagePortChannelArray& webChannels) | 152 void ServiceWorkerContainer::dispatchMessageEvent(const blink::WebString& messag
e, const blink::WebMessagePortChannelArray& webChannels) |
151 { | 153 { |
152 if (!executionContext() || !window()) | 154 if (!executionContext() || !window()) |
153 return; | 155 return; |
154 | 156 |
155 OwnPtr<MessagePortArray> ports = MessagePort::toMessagePortArray(executionCo
ntext(), webChannels); | 157 OwnPtr<MessagePortArray> ports = MessagePort::toMessagePortArray(executionCo
ntext(), webChannels); |
156 RefPtr<SerializedScriptValue> value = SerializedScriptValue::createFromWire(
message); | 158 RefPtr<SerializedScriptValue> value = SerializedScriptValue::createFromWire(
message); |
(...skipping 11 matching lines...) Expand all Loading... |
168 return; | 170 return; |
169 | 171 |
170 if (ServiceWorkerContainerClient* client = ServiceWorkerContainerClient::fro
m(executionContext)) { | 172 if (ServiceWorkerContainerClient* client = ServiceWorkerContainerClient::fro
m(executionContext)) { |
171 m_provider = client->provider(); | 173 m_provider = client->provider(); |
172 if (m_provider) | 174 if (m_provider) |
173 m_provider->setClient(this); | 175 m_provider->setClient(this); |
174 } | 176 } |
175 } | 177 } |
176 | 178 |
177 } // namespace WebCore | 179 } // namespace WebCore |
OLD | NEW |