Skip to content

Commit

Permalink
Bug 1890072 [wpt PR 45590] - Use typed promises/resolvers for Readabl…
Browse files Browse the repository at this point in the history
…eStream and related classes, attempt #3, a=testonly

Automatic update from web-platform-tests
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 <ricea@chromium.org>
Reviewed-by: Nidhi Jaju <nidhijaju@chromium.org>
Commit-Queue: Nate Chapin <japhet@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1289397}

--

wpt-commits: 26d974425bf402e6ceb7a28480800d1942236b8c
wpt-pr: 45590
  • Loading branch information
natechapin authored and moz-wptsync-bot committed Apr 23, 2024
1 parent d0845c9 commit f73e6c1
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ <h1>Long Animation Frame: source location extraction for streams</h1>
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");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@ <h1>Long Animation Frame: stream promise resolvers</h1>
});
response.body.pipeTo(writable);
await readable.getReader().read();
}, "resolve", "StreamPromise.resolve");
}, "resolve", "Promise.resolve");
</script>
</body>
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<!DOCTYPE html>
<body>
<script>
window.onload = () => {
const i = document.createElement("iframe");
i.src = "about:blank";
document.body.appendChild(i);

const rs = new i.contentWindow.ReadableStream({
start(controller) { controller.error(); }
});
const ws = new i.contentWindow.WritableStream();

i.remove();

// pipeTo() should not crash with a ReadableStream or WritableStream from
// a detached iframe.
rs.pipeTo(ws);
};
</script>
</body>
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!doctype html>
<body>
<script>
const i = document.createElement("iframe");
document.body.appendChild(i);

const rs = new i.contentWindow.ReadableStream();
i.remove();

// tee() on a ReadableStream from a detached iframe should not crash.
rs.tee();
</script>
</body>

0 comments on commit f73e6c1

Please sign in to comment.