From 26d974425bf402e6ceb7a28480800d1942236b8c Mon Sep 17 00:00:00 2001 From: Nate Chapin Date: Thu, 18 Apr 2024 10:17:53 -0700 Subject: [PATCH] Use typed promises/resolvers for ReadableStream and related classes, attempt #3 This converts IDL-exposed promises in ReadableStream, ReadableStreamBYOBReader, ReadableStreamDefaultReader, and ReadableStreamGenericReader to use typed ScriptPromiseResolver instead of StreamPromiseResolver and to return typed ScriptPromises. Bug: 329702363 Change-Id: I8ad1af1a7c9c909d711881ce7621c6c9fac58931 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5429731 Reviewed-by: Adam Rice Reviewed-by: Nidhi Jaju Commit-Queue: Nate Chapin Cr-Commit-Position: refs/heads/main@{#1289397} --- .../loaf-stream-source-location.html | 3 ++- .../tentative/loaf-stream.html | 2 +- streams/piping/detached-context-crash.html | 21 +++++++++++++++++++ .../tee-detached-context-crash.html | 13 ++++++++++++ 4 files changed, 37 insertions(+), 2 deletions(-) create mode 100644 streams/piping/detached-context-crash.html create mode 100644 streams/readable-streams/tee-detached-context-crash.html diff --git a/long-animation-frame/tentative/loaf-stream-source-location.html b/long-animation-frame/tentative/loaf-stream-source-location.html index 0fd30859d738de..5776ff52552436 100644 --- a/long-animation-frame/tentative/loaf-stream-source-location.html +++ b/long-animation-frame/tentative/loaf-stream-source-location.html @@ -17,7 +17,8 @@

Long Animation Frame: source location extraction for streams

const scriptElement = document.createElement("script"); scriptElement.src = scriptLocation; document.body.appendChild(scriptElement); - }, script => script.invoker === "StreamPromise.resolve.then", t); + }, script => { + return script.invoker === "Promise.resolve" }, t); assert_true(script.sourceURL.includes("stream-promise-generates-loaf.js")); }, "Source location should be extracted for stream promises"); diff --git a/long-animation-frame/tentative/loaf-stream.html b/long-animation-frame/tentative/loaf-stream.html index e35bc2f9aa7d7d..424f2cd0d1e629 100644 --- a/long-animation-frame/tentative/loaf-stream.html +++ b/long-animation-frame/tentative/loaf-stream.html @@ -34,6 +34,6 @@

Long Animation Frame: stream promise resolvers

}); response.body.pipeTo(writable); await readable.getReader().read(); -}, "resolve", "StreamPromise.resolve"); +}, "resolve", "Promise.resolve"); diff --git a/streams/piping/detached-context-crash.html b/streams/piping/detached-context-crash.html new file mode 100644 index 00000000000000..56271f12c3ae76 --- /dev/null +++ b/streams/piping/detached-context-crash.html @@ -0,0 +1,21 @@ + + + + diff --git a/streams/readable-streams/tee-detached-context-crash.html b/streams/readable-streams/tee-detached-context-crash.html new file mode 100644 index 00000000000000..9488da72732e00 --- /dev/null +++ b/streams/readable-streams/tee-detached-context-crash.html @@ -0,0 +1,13 @@ + + + +