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

Side by Side Diff: Source/core/dom/MessagePort.cpp

Issue 1301953002: WebMessaging: Show a warning when MessagePort attempts to send a transferable ArrayBuffer (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: add const / update test expectation 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/bindings/core/v8/SerializedScriptValue.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 /* 1 /*
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. 2 * Copyright (C) 2008 Apple 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 18 matching lines...) Expand all
29 29
30 #include "bindings/core/v8/ExceptionState.h" 30 #include "bindings/core/v8/ExceptionState.h"
31 #include "bindings/core/v8/ExceptionStatePlaceholder.h" 31 #include "bindings/core/v8/ExceptionStatePlaceholder.h"
32 #include "bindings/core/v8/SerializedScriptValue.h" 32 #include "bindings/core/v8/SerializedScriptValue.h"
33 #include "bindings/core/v8/SerializedScriptValueFactory.h" 33 #include "bindings/core/v8/SerializedScriptValueFactory.h"
34 #include "core/dom/CrossThreadTask.h" 34 #include "core/dom/CrossThreadTask.h"
35 #include "core/dom/ExceptionCode.h" 35 #include "core/dom/ExceptionCode.h"
36 #include "core/dom/ExecutionContext.h" 36 #include "core/dom/ExecutionContext.h"
37 #include "core/events/MessageEvent.h" 37 #include "core/events/MessageEvent.h"
38 #include "core/frame/LocalDOMWindow.h" 38 #include "core/frame/LocalDOMWindow.h"
39 #include "core/inspector/ConsoleMessage.h"
39 #include "core/workers/WorkerGlobalScope.h" 40 #include "core/workers/WorkerGlobalScope.h"
40 #include "public/platform/WebString.h" 41 #include "public/platform/WebString.h"
41 #include "wtf/Functional.h" 42 #include "wtf/Functional.h"
42 #include "wtf/text/AtomicString.h" 43 #include "wtf/text/AtomicString.h"
43 44
44 namespace blink { 45 namespace blink {
45 46
46 MessagePort* MessagePort::create(ExecutionContext& executionContext) 47 MessagePort* MessagePort::create(ExecutionContext& executionContext)
47 { 48 {
48 MessagePort* port = new MessagePort(executionContext); 49 MessagePort* port = new MessagePort(executionContext);
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 if (dataPort == this) { 81 if (dataPort == this) {
81 exceptionState.throwDOMException(DataCloneError, "Port at index " + String::number(i) + " contains the source port."); 82 exceptionState.throwDOMException(DataCloneError, "Port at index " + String::number(i) + " contains the source port.");
82 return; 83 return;
83 } 84 }
84 } 85 }
85 channels = MessagePort::disentanglePorts(context, ports, exceptionState) ; 86 channels = MessagePort::disentanglePorts(context, ports, exceptionState) ;
86 if (exceptionState.hadException()) 87 if (exceptionState.hadException())
87 return; 88 return;
88 } 89 }
89 90
91 if (message->containsTransferableArrayBuffer())
92 executionContext()->addConsoleMessage(ConsoleMessage::create(JSMessageSo urce, WarningMessageLevel, "MessagePort cannot send an ArrayBuffer as a transfer able object yet. See http://crbug.com/334408"));
93
90 WebString messageString = message->toWireString(); 94 WebString messageString = message->toWireString();
91 OwnPtr<WebMessagePortChannelArray> webChannels = toWebMessagePortChannelArra y(channels.release()); 95 OwnPtr<WebMessagePortChannelArray> webChannels = toWebMessagePortChannelArra y(channels.release());
92 m_entangledChannel->postMessage(messageString, webChannels.leakPtr()); 96 m_entangledChannel->postMessage(messageString, webChannels.leakPtr());
93 } 97 }
94 98
95 // static 99 // static
96 PassOwnPtr<WebMessagePortChannelArray> MessagePort::toWebMessagePortChannelArray (PassOwnPtr<MessagePortChannelArray> channels) 100 PassOwnPtr<WebMessagePortChannelArray> MessagePort::toWebMessagePortChannelArray (PassOwnPtr<MessagePortChannelArray> channels)
97 { 101 {
98 OwnPtr<WebMessagePortChannelArray> webChannels; 102 OwnPtr<WebMessagePortChannelArray> webChannels;
99 if (channels && channels->size()) { 103 if (channels && channels->size()) {
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 { 293 {
290 ASSERT(executionContext()); 294 ASSERT(executionContext());
291 if (!m_scriptStateForConversion) { 295 if (!m_scriptStateForConversion) {
292 v8::Isolate* isolate = scriptIsolate(); 296 v8::Isolate* isolate = scriptIsolate();
293 m_scriptStateForConversion = ScriptState::create(v8::Context::New(isolat e), DOMWrapperWorld::create(isolate)); 297 m_scriptStateForConversion = ScriptState::create(v8::Context::New(isolat e), DOMWrapperWorld::create(isolate));
294 } 298 }
295 return m_scriptStateForConversion->context(); 299 return m_scriptStateForConversion->context();
296 } 300 }
297 301
298 } // namespace blink 302 } // namespace blink
OLDNEW
« no previous file with comments | « Source/bindings/core/v8/SerializedScriptValue.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698