Skip to content
Permalink
Browse files
Drop [UsePointersEvenForNonNullableObjectArguments] from WebSocket
https://bugs.webkit.org/show_bug.cgi?id=156897

Reviewed by Chris Dumez.

No change of behavior.

Updating WebSocket::send methods to take references, except for ArrayBufferView, which is not yet supported by the binding generator.

* Modules/websockets/WebSocket.cpp:
(WebCore::WebSocket::send):
* Modules/websockets/WebSocket.h:
* Modules/websockets/WebSocket.idl:


Canonical link: https://commits.webkit.org/175065@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@199961 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
youennf committed Apr 24, 2016
1 parent edcff5e commit 02dfea739c0ddaa594f87ee4e89df921104a6a8b
@@ -1,3 +1,19 @@
2016-04-24 Youenn Fablet <youenn.fablet@crf.canon.fr>

Drop [UsePointersEvenForNonNullableObjectArguments] from WebSocket
https://bugs.webkit.org/show_bug.cgi?id=156897

Reviewed by Chris Dumez.

No change of behavior.

Updating WebSocket::send methods to take references, except for ArrayBufferView, which is not yet supported by the binding generator.

* Modules/websockets/WebSocket.cpp:
(WebCore::WebSocket::send):
* Modules/websockets/WebSocket.h:
* Modules/websockets/WebSocket.idl:

2016-04-23 Andy Estes <aestes@apple.com>

Fix issues found by the clang static analyzer
@@ -322,22 +322,21 @@ void WebSocket::send(const String& message, ExceptionCode& ec)
}
}

void WebSocket::send(ArrayBuffer* binaryData, ExceptionCode& ec)
void WebSocket::send(ArrayBuffer& binaryData, ExceptionCode& ec)
{
LOG(Network, "WebSocket %p send() Sending ArrayBuffer %p", this, binaryData);
ASSERT(binaryData);
LOG(Network, "WebSocket %p send() Sending ArrayBuffer %p", this, &binaryData);
if (m_state == CONNECTING) {
ec = INVALID_STATE_ERR;
return;
}
if (m_state == CLOSING || m_state == CLOSED) {
unsigned payloadSize = binaryData->byteLength();
unsigned payloadSize = binaryData.byteLength();
m_bufferedAmountAfterClose = saturateAdd(m_bufferedAmountAfterClose, payloadSize);
m_bufferedAmountAfterClose = saturateAdd(m_bufferedAmountAfterClose, getFramingOverhead(payloadSize));
return;
}
ASSERT(m_channel);
m_channel->send(*binaryData, 0, binaryData->byteLength());
m_channel->send(binaryData, 0, binaryData.byteLength());
}

void WebSocket::send(ArrayBufferView* arrayBufferView, ExceptionCode& ec)
@@ -359,21 +358,21 @@ void WebSocket::send(ArrayBufferView* arrayBufferView, ExceptionCode& ec)
m_channel->send(*arrayBuffer, arrayBufferView->byteOffset(), arrayBufferView->byteLength());
}

void WebSocket::send(Blob* binaryData, ExceptionCode& ec)
void WebSocket::send(Blob& binaryData, ExceptionCode& ec)
{
LOG(Network, "WebSocket %p send() Sending Blob '%s'", this, binaryData->url().stringCenterEllipsizedToLength().utf8().data());
LOG(Network, "WebSocket %p send() Sending Blob '%s'", this, binaryData.url().stringCenterEllipsizedToLength().utf8().data());
if (m_state == CONNECTING) {
ec = INVALID_STATE_ERR;
return;
}
if (m_state == CLOSING || m_state == CLOSED) {
unsigned long payloadSize = static_cast<unsigned long>(binaryData->size());
unsigned long payloadSize = static_cast<unsigned long>(binaryData.size());
m_bufferedAmountAfterClose = saturateAdd(m_bufferedAmountAfterClose, payloadSize);
m_bufferedAmountAfterClose = saturateAdd(m_bufferedAmountAfterClose, getFramingOverhead(payloadSize));
return;
}
ASSERT(m_channel);
m_channel->send(*binaryData);
m_channel->send(binaryData);
}

void WebSocket::close(int code, const String& reason, ExceptionCode& ec)
@@ -72,9 +72,9 @@ class WebSocket final : public RefCounted<WebSocket>, public EventTargetWithInli
void connect(const String& url, const Vector<String>& protocols, ExceptionCode&);

void send(const String& message, ExceptionCode&);
void send(JSC::ArrayBuffer*, ExceptionCode&);
void send(JSC::ArrayBuffer&, ExceptionCode&);
void send(JSC::ArrayBufferView*, ExceptionCode&);
void send(Blob*, ExceptionCode&);
void send(Blob&, ExceptionCode&);

void close(int code, const String& reason, ExceptionCode&);
void close(ExceptionCode& ec) { close(WebSocketChannel::CloseEventCodeNotSpecified, String(), ec); }
@@ -30,15 +30,14 @@
*/

[
Exposed=(Window,Worker),
EnabledAtRuntime,
Conditional=WEB_SOCKETS,
ActiveDOMObject,
Conditional=WEB_SOCKETS,
Constructor(DOMString url, [Default=Undefined] optional sequence<DOMString>? protocols),
Constructor(DOMString url, DOMString protocol),
ConstructorRaisesException,
ConstructorCallWith=ScriptExecutionContext,
UsePointersEvenForNonNullableObjectArguments,
EnabledAtRuntime,
Exposed=(Window,Worker),
] interface WebSocket : EventTarget {
readonly attribute DOMString URL; // Lowercased .url is the one in the spec, but leaving .URL for compatibility reasons.
readonly attribute DOMString url;

0 comments on commit 02dfea7

Please sign in to comment.