Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(321)

Side by Side Diff: Source/modules/serviceworkers/ServiceWorkerClient.cpp

Issue 1303823002: ServiceWorker: Show a warning when ServiceWorker(Client) attempts to send a transferable ArrayBuffer (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/modules/serviceworkers/ServiceWorker.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "config.h" 5 #include "config.h"
6 #include "modules/serviceworkers/ServiceWorkerClient.h" 6 #include "modules/serviceworkers/ServiceWorkerClient.h"
7 7
8 #include "bindings/core/v8/CallbackPromiseAdapter.h" 8 #include "bindings/core/v8/CallbackPromiseAdapter.h"
9 #include "bindings/core/v8/ExceptionState.h" 9 #include "bindings/core/v8/ExceptionState.h"
10 #include "bindings/core/v8/SerializedScriptValue.h" 10 #include "bindings/core/v8/SerializedScriptValue.h"
11 #include "core/inspector/ConsoleMessage.h"
11 #include "modules/serviceworkers/ServiceWorkerGlobalScopeClient.h" 12 #include "modules/serviceworkers/ServiceWorkerGlobalScopeClient.h"
12 #include "public/platform/WebString.h" 13 #include "public/platform/WebString.h"
13 #include "wtf/RefPtr.h" 14 #include "wtf/RefPtr.h"
14 15
15 namespace blink { 16 namespace blink {
16 17
17 ServiceWorkerClient* ServiceWorkerClient::create(const WebServiceWorkerClientInf o& info) 18 ServiceWorkerClient* ServiceWorkerClient::create(const WebServiceWorkerClientInf o& info)
18 { 19 {
19 return new ServiceWorkerClient(info); 20 return new ServiceWorkerClient(info);
20 } 21 }
(...skipping 26 matching lines...) Expand all
47 return String(); 48 return String();
48 } 49 }
49 50
50 void ServiceWorkerClient::postMessage(ExecutionContext* context, PassRefPtr<Seri alizedScriptValue> message, const MessagePortArray* ports, ExceptionState& excep tionState) 51 void ServiceWorkerClient::postMessage(ExecutionContext* context, PassRefPtr<Seri alizedScriptValue> message, const MessagePortArray* ports, ExceptionState& excep tionState)
51 { 52 {
52 // Disentangle the port in preparation for sending it to the remote context. 53 // Disentangle the port in preparation for sending it to the remote context.
53 OwnPtr<MessagePortChannelArray> channels = MessagePort::disentanglePorts(con text, ports, exceptionState); 54 OwnPtr<MessagePortChannelArray> channels = MessagePort::disentanglePorts(con text, ports, exceptionState);
54 if (exceptionState.hadException()) 55 if (exceptionState.hadException())
55 return; 56 return;
56 57
58 if (message->containsTransferableArrayBuffer())
59 context->addConsoleMessage(ConsoleMessage::create(JSMessageSource, Warni ngMessageLevel, "ServiceWorkerClient cannot send an ArrayBuffer as a transferabl e object yet. See http://crbug.com/511119"));
60
57 WebString messageString = message->toWireString(); 61 WebString messageString = message->toWireString();
58 OwnPtr<WebMessagePortChannelArray> webChannels = MessagePort::toWebMessagePo rtChannelArray(channels.release()); 62 OwnPtr<WebMessagePortChannelArray> webChannels = MessagePort::toWebMessagePo rtChannelArray(channels.release());
59 ServiceWorkerGlobalScopeClient::from(context)->postMessageToClient(m_uuid, m essageString, webChannels.release()); 63 ServiceWorkerGlobalScopeClient::from(context)->postMessageToClient(m_uuid, m essageString, webChannels.release());
60 } 64 }
61 65
62 } // namespace blink 66 } // namespace blink
OLDNEW
« no previous file with comments | « Source/modules/serviceworkers/ServiceWorker.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698