void RTCDataChannel::send(const String& data, ExceptionState& exceptionState) { if (m_readyState != ReadyStateOpen) { throwNotOpenException(exceptionState); return; } if (!m_handler->sendStringData(data)) { // FIXME: This should not throw an exception but instead forcefully close the data channel. throwCouldNotSendDataException(exceptionState); } }
void RTCDataChannel::send(DOMArrayBuffer* data, ExceptionState& exceptionState) { if (m_readyState != ReadyStateOpen) { throwNotOpenException(exceptionState); return; } size_t dataLength = data->byteLength(); if (!dataLength) return; if (!m_handler->sendRawData(static_cast<const char*>((data->data())), dataLength)) { // FIXME: This should not throw an exception but instead forcefully close the data channel. throwCouldNotSendDataException(exceptionState); } }