Commit c4b2ca77 authored by Eric Willigers's avatar Eric Willigers Committed by Chromium LUCI CQ

Direct Sockets: ensure script context valid before reading

If the script context is not valid during an attempted read, we exit
early. This avoids crashes, for example, if navigation or page refresh
occurs while a read is pending.

Bug: 905818
Change-Id: I1cf2e44eabb6ce35864c3a95e5930ae15c2cc49e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2612231Reviewed-by: default avatarGlen Robertson <glenrob@chromium.org>
Commit-Queue: Eric Willigers <ericwilligers@chromium.org>
Cr-Commit-Position: refs/heads/master@{#840514}
parent 5d781a07
...@@ -142,6 +142,9 @@ void TCPReadableStreamWrapper::OnPeerClosed(MojoResult result, ...@@ -142,6 +142,9 @@ void TCPReadableStreamWrapper::OnPeerClosed(MojoResult result,
} }
void TCPReadableStreamWrapper::ReadFromPipeAndEnqueue() { void TCPReadableStreamWrapper::ReadFromPipeAndEnqueue() {
if (!script_state_->ContextIsValid())
return;
DVLOG(1) << "TCPReadableStreamWrapper::ReadFromPipeAndEnqueue() this=" << this DVLOG(1) << "TCPReadableStreamWrapper::ReadFromPipeAndEnqueue() this=" << this
<< " in_two_phase_read_=" << in_two_phase_read_ << " in_two_phase_read_=" << in_two_phase_read_
<< " read_pending_=" << read_pending_; << " read_pending_=" << read_pending_;
......
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