Commit 6054afe4 authored by Hitoshi Yoshida's avatar Hitoshi Yoshida Committed by Commit Bot

bindings: Fix check of WebSocketStreamOptions.signal

WebSocketStreamOptions.signal is a non-nullable dictionary member.
This CL fixes the way to check if it is missing; makes to call
hasSignal() instead of checking a nullptr.

This is a preparation for the new code generator, with which the
original code would crash.

Bug: 839389
Change-Id: I5d43009f4998b00bc4705a912148382fbf2902a0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2214739
Commit-Queue: Hitoshi Yoshida <peria@chromium.org>
Commit-Queue: Kentaro Hara <haraken@chromium.org>
Auto-Submit: Hitoshi Yoshida <peria@chromium.org>
Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Cr-Commit-Position: refs/heads/master@{#772130}
parent 9bf44be4
...@@ -611,17 +611,17 @@ void WebSocketStream::Connect(ScriptState* script_state, ...@@ -611,17 +611,17 @@ void WebSocketStream::Connect(ScriptState* script_state,
// Don't read all of a huge initial message before read() has been called. // Don't read all of a huge initial message before read() has been called.
channel_->ApplyBackpressure(); channel_->ApplyBackpressure();
auto* signal = options->signal(); if (options->hasSignal()) {
if (signal && signal->aborted()) { auto* signal = options->signal();
auto exception = V8ThrowDOMException::CreateOrEmpty( if (signal->aborted()) {
script_state->GetIsolate(), DOMExceptionCode::kAbortError, auto exception = V8ThrowDOMException::CreateOrEmpty(
"WebSocket handshake was aborted"); script_state->GetIsolate(), DOMExceptionCode::kAbortError,
connection_resolver_->Reject(exception); "WebSocket handshake was aborted");
closed_resolver_->Reject(exception); connection_resolver_->Reject(exception);
return; closed_resolver_->Reject(exception);
} return;
}
if (signal) {
signal->AddAlgorithm( signal->AddAlgorithm(
WTF::Bind(&WebSocketStream::OnAbort, WrapWeakPersistent(this))); WTF::Bind(&WebSocketStream::OnAbort, WrapWeakPersistent(this)));
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment