Commit 1508bc0b authored by Adam Rice's avatar Adam Rice Committed by Commit Bot

ReadableStream tee() cancel bug fix

Always resolve tee's cancel promise after stream closes or errors.
Applies https://github.com/whatwg/streams/pull/1039 to our
implementation.

BUG=1114014

Change-Id: Ic6d665bd928553ea3a292fe8221f0812d1c613e7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2358929Reviewed-by: default avatarYutaka Hirano <yhirano@chromium.org>
Commit-Queue: Adam Rice <ricea@chromium.org>
Cr-Commit-Position: refs/heads/master@{#798520}
parent 3b08f509
......@@ -860,6 +860,12 @@ class ReadableStream::TeeEngine::PullAlgorithm final : public StreamAlgorithm {
script_state, engine_->controller_[branch]);
}
}
// TODO(ricea): Implement https://github.com/whatwg/streams/pull/1045 so
// this step can be numbered correctly.
// Resolve |cancelPromise| with undefined.
engine_->cancel_promise_->ResolveWithUndefined(script_state);
// 3. Set closed to true.
engine_->closed_ = true;
......@@ -1068,6 +1074,11 @@ void ReadableStream::TeeEngine::Start(ScriptState* script_state,
// [[readableStreamController]], r).
ReadableStreamDefaultController::Error(GetScriptState(),
engine_->controller_[1], r);
// TODO(ricea): Implement https://github.com/whatwg/streams/pull/1045 so
// this step can be numbered correctly.
// Resolve |cancelPromise| with undefined.
engine_->cancel_promise_->ResolveWithUndefined(GetScriptState());
}
void Trace(Visitor* visitor) const override {
......
......@@ -2689,18 +2689,6 @@ crbug.com/1105958 external/wpt/payment-request/payment-is-showing.https.html [ T
# ====== New tests from wpt-importer added here ======
crbug.com/626703 external/wpt/dom/events/Event-dispatch-click.html [ Timeout ]
crbug.com/626703 [ Linux ] external/wpt/streams/readable-streams/tee.any.serviceworker.html [ Timeout ]
crbug.com/626703 [ Mac ] external/wpt/streams/readable-streams/tee.any.serviceworker.html [ Timeout ]
crbug.com/626703 [ Win ] external/wpt/streams/readable-streams/tee.any.serviceworker.html [ Timeout ]
crbug.com/626703 [ Linux ] external/wpt/streams/readable-streams/tee.any.sharedworker.html [ Timeout ]
crbug.com/626703 [ Mac ] external/wpt/streams/readable-streams/tee.any.sharedworker.html [ Timeout ]
crbug.com/626703 [ Win ] external/wpt/streams/readable-streams/tee.any.sharedworker.html [ Timeout ]
crbug.com/626703 [ Linux ] external/wpt/streams/readable-streams/tee.any.html [ Timeout ]
crbug.com/626703 [ Mac ] external/wpt/streams/readable-streams/tee.any.html [ Timeout ]
crbug.com/626703 [ Win ] external/wpt/streams/readable-streams/tee.any.html [ Timeout ]
crbug.com/626703 [ Linux ] external/wpt/streams/readable-streams/tee.any.worker.html [ Timeout ]
crbug.com/626703 [ Mac ] external/wpt/streams/readable-streams/tee.any.worker.html [ Timeout ]
crbug.com/626703 [ Win ] external/wpt/streams/readable-streams/tee.any.worker.html [ Timeout ]
crbug.com/626703 [ Linux ] external/wpt/input-events/input-events-get-target-ranges-backspace.tentative.html [ Timeout ]
crbug.com/626703 [ Mac ] external/wpt/input-events/input-events-get-target-ranges-backspace.tentative.html [ Timeout ]
crbug.com/626703 [ Win ] external/wpt/input-events/input-events-get-target-ranges-backspace.tentative.html [ Timeout ]
......
......@@ -12,6 +12,8 @@ PASS ReadableStream teeing: erroring a teed stream should properly handle cancel
PASS ReadableStream teeing: erroring a teed stream should error both branches
PASS ReadableStream teeing: closing the original should immediately close the branches
PASS ReadableStream teeing: erroring the original should immediately error the branches
PASS ReadableStream teeing: canceling branch1 should finish when branch2 reads until end of stream
PASS ReadableStream teeing: canceling branch1 should finish when original stream errors
PASS ReadableStreamTee should not use a modified ReadableStream constructor from the global object
FAIL ReadableStreamTee should not pull more chunks than can fit in the branch queue assert_array_equals: pull should only be called once lengths differ, expected array ["pull"] length 1, got ["pull", "pull"] length 2
PASS ReadableStreamTee should only pull enough to fill the emptiest queue
......
......@@ -12,6 +12,8 @@ PASS ReadableStream teeing: erroring a teed stream should properly handle cancel
PASS ReadableStream teeing: erroring a teed stream should error both branches
PASS ReadableStream teeing: closing the original should immediately close the branches
PASS ReadableStream teeing: erroring the original should immediately error the branches
PASS ReadableStream teeing: canceling branch1 should finish when branch2 reads until end of stream
PASS ReadableStream teeing: canceling branch1 should finish when original stream errors
PASS ReadableStreamTee should not use a modified ReadableStream constructor from the global object
FAIL ReadableStreamTee should not pull more chunks than can fit in the branch queue assert_array_equals: pull should only be called once lengths differ, expected array ["pull"] length 1, got ["pull", "pull"] length 2
PASS ReadableStreamTee should only pull enough to fill the emptiest queue
......
......@@ -12,6 +12,8 @@ PASS ReadableStream teeing: erroring a teed stream should properly handle cancel
PASS ReadableStream teeing: erroring a teed stream should error both branches
PASS ReadableStream teeing: closing the original should immediately close the branches
PASS ReadableStream teeing: erroring the original should immediately error the branches
PASS ReadableStream teeing: canceling branch1 should finish when branch2 reads until end of stream
PASS ReadableStream teeing: canceling branch1 should finish when original stream errors
PASS ReadableStreamTee should not use a modified ReadableStream constructor from the global object
FAIL ReadableStreamTee should not pull more chunks than can fit in the branch queue assert_array_equals: pull should only be called once lengths differ, expected array ["pull"] length 1, got ["pull", "pull"] length 2
PASS ReadableStreamTee should only pull enough to fill the emptiest queue
......
......@@ -12,6 +12,8 @@ PASS ReadableStream teeing: erroring a teed stream should properly handle cancel
PASS ReadableStream teeing: erroring a teed stream should error both branches
PASS ReadableStream teeing: closing the original should immediately close the branches
PASS ReadableStream teeing: erroring the original should immediately error the branches
PASS ReadableStream teeing: canceling branch1 should finish when branch2 reads until end of stream
PASS ReadableStream teeing: canceling branch1 should finish when original stream errors
PASS ReadableStreamTee should not use a modified ReadableStream constructor from the global object
FAIL ReadableStreamTee should not pull more chunks than can fit in the branch queue assert_array_equals: pull should only be called once lengths differ, expected array ["pull"] length 1, got ["pull", "pull"] length 2
PASS ReadableStreamTee should only pull enough to fill the emptiest queue
......
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