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

Side by Side Diff: third_party/WebKit/Source/core/events/MessageEvent.cpp

Issue 1925963002: InitEvent should not do anything if dispatch flag is set. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated as per review comments Created 4 years, 7 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007 Henry Mason (hmason@mac.com) 2 * Copyright (C) 2007 Henry Mason (hmason@mac.com)
3 * Copyright (C) 2003, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. 3 * Copyright (C) 2003, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 { 133 {
134 if (initializer.source() && !isValidSource(initializer.source())) { 134 if (initializer.source() && !isValidSource(initializer.source())) {
135 exceptionState.throwTypeError("The optional 'source' property is neither a Window nor MessagePort."); 135 exceptionState.throwTypeError("The optional 'source' property is neither a Window nor MessagePort.");
136 return nullptr; 136 return nullptr;
137 } 137 }
138 return new MessageEvent(type, initializer); 138 return new MessageEvent(type, initializer);
139 } 139 }
140 140
141 void MessageEvent::initMessageEvent(const AtomicString& type, bool canBubble, bo ol cancelable, ScriptValue data, const String& origin, const String& lastEventId , DOMWindow* source, MessagePortArray* ports) 141 void MessageEvent::initMessageEvent(const AtomicString& type, bool canBubble, bo ol cancelable, ScriptValue data, const String& origin, const String& lastEventId , DOMWindow* source, MessagePortArray* ports)
142 { 142 {
143 if (dispatched()) 143 if (isBeingDispatched())
144 return; 144 return;
145 145
146 initEvent(type, canBubble, cancelable); 146 initEvent(type, canBubble, cancelable);
147 147
148 m_dataType = DataTypeScriptValue; 148 m_dataType = DataTypeScriptValue;
149 m_dataAsScriptValue = data; 149 m_dataAsScriptValue = data;
150 m_origin = origin; 150 m_origin = origin;
151 m_lastEventId = lastEventId; 151 m_lastEventId = lastEventId;
152 m_source = source; 152 m_source = source;
153 m_ports = ports; 153 m_ports = ports;
154 m_suborigin = ""; 154 m_suborigin = "";
155 } 155 }
156 156
157 void MessageEvent::initMessageEvent(const AtomicString& type, bool canBubble, bo ol cancelable, PassRefPtr<SerializedScriptValue> data, const String& origin, con st String& lastEventId, DOMWindow* source, MessagePortArray* ports) 157 void MessageEvent::initMessageEvent(const AtomicString& type, bool canBubble, bo ol cancelable, PassRefPtr<SerializedScriptValue> data, const String& origin, con st String& lastEventId, DOMWindow* source, MessagePortArray* ports)
158 { 158 {
159 if (dispatched()) 159 if (isBeingDispatched())
160 return; 160 return;
161 161
162 initEvent(type, canBubble, cancelable); 162 initEvent(type, canBubble, cancelable);
163 163
164 m_dataType = DataTypeSerializedScriptValue; 164 m_dataType = DataTypeSerializedScriptValue;
165 m_dataAsSerializedScriptValue = data; 165 m_dataAsSerializedScriptValue = data;
166 m_origin = origin; 166 m_origin = origin;
167 m_lastEventId = lastEventId; 167 m_lastEventId = lastEventId;
168 m_source = source; 168 m_source = source;
169 m_ports = ports; 169 m_ports = ports;
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 break; 230 break;
231 case MessageEvent::DataTypeArrayBuffer: 231 case MessageEvent::DataTypeArrayBuffer:
232 V8HiddenValue::setHiddenValue(ScriptState::current(isolate), wrapper, V8 HiddenValue::arrayBufferData(isolate), toV8(dataAsArrayBuffer(), wrapper, isolat e)); 232 V8HiddenValue::setHiddenValue(ScriptState::current(isolate), wrapper, V8 HiddenValue::arrayBufferData(isolate), toV8(dataAsArrayBuffer(), wrapper, isolat e));
233 break; 233 break;
234 } 234 }
235 235
236 return wrapper; 236 return wrapper;
237 } 237 }
238 238
239 } // namespace blink 239 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/events/KeyboardEvent.cpp ('k') | third_party/WebKit/Source/core/events/MouseEvent.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698