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

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

Issue 19765010: postMessage() should throw a DataCloneError on invalid transferables (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « Source/bindings/v8/V8Utilities.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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 if (!isEntangled()) 61 if (!isEntangled())
62 return; 62 return;
63 ASSERT(m_scriptExecutionContext); 63 ASSERT(m_scriptExecutionContext);
64 64
65 OwnPtr<MessagePortChannelArray> channels; 65 OwnPtr<MessagePortChannelArray> channels;
66 // Make sure we aren't connected to any of the passed-in ports. 66 // Make sure we aren't connected to any of the passed-in ports.
67 if (ports) { 67 if (ports) {
68 for (unsigned int i = 0; i < ports->size(); ++i) { 68 for (unsigned int i = 0; i < ports->size(); ++i) {
69 MessagePort* dataPort = (*ports)[i].get(); 69 MessagePort* dataPort = (*ports)[i].get();
70 if (dataPort == this || m_entangledChannel->isConnectedTo(dataPort)) { 70 if (dataPort == this || m_entangledChannel->isConnectedTo(dataPort)) {
71 es.throwDOMException(InvalidStateError); 71 es.throwDOMException(DataCloneError);
72 return; 72 return;
73 } 73 }
74 } 74 }
75 channels = MessagePort::disentanglePorts(ports, es); 75 channels = MessagePort::disentanglePorts(ports, es);
76 if (es.hadException()) 76 if (es.hadException())
77 return; 77 return;
78 } 78 }
79 m_entangledChannel->postMessageToRemote(message, channels.release()); 79 m_entangledChannel->postMessageToRemote(message, channels.release());
80 } 80 }
81 81
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 { 234 {
235 return &m_eventTargetData; 235 return &m_eventTargetData;
236 } 236 }
237 237
238 EventTargetData* MessagePort::ensureEventTargetData() 238 EventTargetData* MessagePort::ensureEventTargetData()
239 { 239 {
240 return &m_eventTargetData; 240 return &m_eventTargetData;
241 } 241 }
242 242
243 } // namespace WebCore 243 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/bindings/v8/V8Utilities.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698