aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/readablestream.rs
diff options
context:
space:
mode:
authorGae24 <96017547+Gae24@users.noreply.github.com>2025-02-23 05:45:47 +0100
committerGitHub <noreply@github.com>2025-02-23 04:45:47 +0000
commitadb831eefea3b98369dab56fa1ef4f668900974c (patch)
tree8e148ec0476398a41114397f4399cd63c7c37eed /components/script/dom/readablestream.rs
parentdd13342f184bee27ed1591a122727adca1247004 (diff)
downloadservo-adb831eefea3b98369dab56fa1ef4f668900974c.tar.gz
servo-adb831eefea3b98369dab56fa1ef4f668900974c.zip
script: add `CanGc` argument to `Promise::new_resolved` and `Promise::new_rejected` (#35605)
* add CanGc to new_resolved and use it where possible Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com> * add CanGc to new_rejected Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com> --------- Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com>
Diffstat (limited to 'components/script/dom/readablestream.rs')
-rw-r--r--components/script/dom/readablestream.rs4
1 files changed, 1 insertions, 3 deletions
diff --git a/components/script/dom/readablestream.rs b/components/script/dom/readablestream.rs
index bc9a5dec08c..77c12ab6b81 100644
--- a/components/script/dom/readablestream.rs
+++ b/components/script/dom/readablestream.rs
@@ -666,9 +666,7 @@ impl ReadableStream {
// If stream.[[state]] is "closed", return a promise resolved with undefined.
if self.is_closed() {
- let promise = Promise::new(&self.global(), can_gc);
- promise.resolve_native(&());
- return promise;
+ return Promise::new_resolved(&self.global(), GlobalScope::get_cx(), (), can_gc);
}
// If stream.[[state]] is "errored", return a promise rejected with stream.[[storedError]].
if self.is_errored() {