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 16 matching lines...) Expand all Loading... |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #include "modules/serviceworkers/ServiceWorker.h" | 31 #include "modules/serviceworkers/ServiceWorker.h" |
32 | 32 |
33 #include "bindings/core/v8/ExceptionState.h" | 33 #include "bindings/core/v8/ExceptionState.h" |
34 #include "core/dom/ExceptionCode.h" | 34 #include "core/dom/ExceptionCode.h" |
35 #include "core/dom/MessagePort.h" | 35 #include "core/dom/MessagePort.h" |
36 #include "core/events/Event.h" | 36 #include "core/events/Event.h" |
37 #include "core/inspector/ConsoleMessage.h" | |
38 #include "modules/EventTargetModules.h" | 37 #include "modules/EventTargetModules.h" |
39 #include "modules/serviceworkers/ServiceWorkerContainerClient.h" | 38 #include "modules/serviceworkers/ServiceWorkerContainerClient.h" |
40 #include "public/platform/WebMessagePortChannel.h" | 39 #include "public/platform/WebMessagePortChannel.h" |
41 #include "public/platform/WebSecurityOrigin.h" | 40 #include "public/platform/WebSecurityOrigin.h" |
42 #include "public/platform/WebString.h" | 41 #include "public/platform/WebString.h" |
43 #include "public/platform/modules/serviceworker/WebServiceWorkerState.h" | 42 #include "public/platform/modules/serviceworker/WebServiceWorkerState.h" |
44 #include <memory> | 43 #include <memory> |
45 | 44 |
46 namespace blink { | 45 namespace blink { |
47 | 46 |
(...skipping 18 matching lines...) Expand all Loading... |
66 std::unique_ptr<MessagePortChannelArray> channels = | 65 std::unique_ptr<MessagePortChannelArray> channels = |
67 MessagePort::disentanglePorts(context, ports, exceptionState); | 66 MessagePort::disentanglePorts(context, ports, exceptionState); |
68 if (exceptionState.hadException()) | 67 if (exceptionState.hadException()) |
69 return; | 68 return; |
70 if (m_handle->serviceWorker()->state() == WebServiceWorkerStateRedundant) { | 69 if (m_handle->serviceWorker()->state() == WebServiceWorkerStateRedundant) { |
71 exceptionState.throwDOMException(InvalidStateError, | 70 exceptionState.throwDOMException(InvalidStateError, |
72 "ServiceWorker is in redundant state."); | 71 "ServiceWorker is in redundant state."); |
73 return; | 72 return; |
74 } | 73 } |
75 | 74 |
76 if (message->containsTransferableArrayBuffer()) | |
77 context->addConsoleMessage(ConsoleMessage::create( | |
78 JSMessageSource, WarningMessageLevel, | |
79 "ServiceWorker cannot send an ArrayBuffer as a transferable object " | |
80 "yet. See http://crbug.com/511119")); | |
81 | |
82 WebString messageString = message->toWireString(); | 75 WebString messageString = message->toWireString(); |
83 std::unique_ptr<WebMessagePortChannelArray> webChannels = | 76 std::unique_ptr<WebMessagePortChannelArray> webChannels = |
84 MessagePort::toWebMessagePortChannelArray(std::move(channels)); | 77 MessagePort::toWebMessagePortChannelArray(std::move(channels)); |
85 m_handle->serviceWorker()->postMessage( | 78 m_handle->serviceWorker()->postMessage( |
86 client->provider(), messageString, | 79 client->provider(), messageString, |
87 WebSecurityOrigin(getExecutionContext()->getSecurityOrigin()), | 80 WebSecurityOrigin(getExecutionContext()->getSecurityOrigin()), |
88 webChannels.release()); | 81 webChannels.release()); |
89 } | 82 } |
90 | 83 |
91 void ServiceWorker::internalsTerminate() { | 84 void ServiceWorker::internalsTerminate() { |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 m_handle->serviceWorker()->setProxy(this); | 160 m_handle->serviceWorker()->setProxy(this); |
168 } | 161 } |
169 | 162 |
170 ServiceWorker::~ServiceWorker() {} | 163 ServiceWorker::~ServiceWorker() {} |
171 | 164 |
172 DEFINE_TRACE(ServiceWorker) { | 165 DEFINE_TRACE(ServiceWorker) { |
173 AbstractWorker::trace(visitor); | 166 AbstractWorker::trace(visitor); |
174 } | 167 } |
175 | 168 |
176 } // namespace blink | 169 } // namespace blink |
OLD | NEW |