Commit c575a0dc authored by Adam Rice's avatar Adam Rice Committed by Commit Bot

Transferable Streams: Don't permit the remote side to crash us

The transferable streams implementation assumed that two kPull messages
couldn't be sent without an intervening chunk. This wasn't true in the
case of a compromised renderer, and since
https://chromium-review.googlesource.com/c/chromium/src/+/2291180 hasn't
been true in general.

This change aligns the implementation with the proposed standard at
https://chromium-review.googlesource.com/c/chromium/src/+/2291180.

This fixes flakiness in the http/tests/streams/transferable/worker.html
test.

BUG=1106239,1106239

Change-Id: I12c9d011c4a42c8178fcaffa4ddd23e38fb82d9e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2303329Reviewed-by: default avatarYutaka Hirano <yhirano@chromium.org>
Commit-Queue: Adam Rice <ricea@chromium.org>
Cr-Commit-Position: refs/heads/master@{#789389}
parent 7a902237
...@@ -454,9 +454,10 @@ void CrossRealmTransformWritable::HandleMessage(MessageType type, ...@@ -454,9 +454,10 @@ void CrossRealmTransformWritable::HandleMessage(MessageType type,
v8::Local<v8::Value> value) { v8::Local<v8::Value> value) {
switch (type) { switch (type) {
case MessageType::kPull: case MessageType::kPull:
DCHECK(backpressure_promise_); if (backpressure_promise_) {
backpressure_promise_->ResolveWithUndefined(script_state_); backpressure_promise_->ResolveWithUndefined(script_state_);
backpressure_promise_ = nullptr; backpressure_promise_ = nullptr;
}
return; return;
case MessageType::kCancel: case MessageType::kCancel:
......
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