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

Side by Side Diff: Source/modules/mediastream/RTCDataChannel.cpp

Issue 235123002: Should throw TypeError instead of TypeMismatchError (modules) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 8 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) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 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 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 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 return String(); 158 return String();
159 } 159 }
160 160
161 void RTCDataChannel::setBinaryType(const String& binaryType, ExceptionState& exc eptionState) 161 void RTCDataChannel::setBinaryType(const String& binaryType, ExceptionState& exc eptionState)
162 { 162 {
163 if (binaryType == "blob") 163 if (binaryType == "blob")
164 throwNoBlobSupportException(exceptionState); 164 throwNoBlobSupportException(exceptionState);
165 else if (binaryType == "arraybuffer") 165 else if (binaryType == "arraybuffer")
166 m_binaryType = BinaryTypeArrayBuffer; 166 m_binaryType = BinaryTypeArrayBuffer;
167 else 167 else
168 exceptionState.throwDOMException(TypeMismatchError, "Unknown binary type : " + binaryType); 168 exceptionState.throwDOMException(TypeError, "Unknown binary type : " + b inaryType);
169 } 169 }
170 170
171 void RTCDataChannel::send(const String& data, ExceptionState& exceptionState) 171 void RTCDataChannel::send(const String& data, ExceptionState& exceptionState)
172 { 172 {
173 if (m_readyState != ReadyStateOpen) { 173 if (m_readyState != ReadyStateOpen) {
174 throwNotOpenException(exceptionState); 174 throwNotOpenException(exceptionState);
175 return; 175 return;
176 } 176 }
177 if (!m_handler->sendStringData(data)) { 177 if (!m_handler->sendStringData(data)) {
178 // FIXME: This should not throw an exception but instead forcefully clos e the data channel. 178 // FIXME: This should not throw an exception but instead forcefully clos e the data channel.
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 events.swap(m_scheduledEvents); 308 events.swap(m_scheduledEvents);
309 309
310 WillBeHeapVector<RefPtrWillBeMember<Event> >::iterator it = events.begin(); 310 WillBeHeapVector<RefPtrWillBeMember<Event> >::iterator it = events.begin();
311 for (; it != events.end(); ++it) 311 for (; it != events.end(); ++it)
312 dispatchEvent((*it).release()); 312 dispatchEvent((*it).release());
313 313
314 events.clear(); 314 events.clear();
315 } 315 }
316 316
317 } // namespace WebCore 317 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/modules/mediastream/MediaStream.cpp ('k') | Source/modules/mediastream/RTCIceCandidate.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698