From c7eba2dbbac24e8571d12ce686173a11b287c5ca Mon Sep 17 00:00:00 2001 From: Aokingo <64444692+Anne-Okingo@users.noreply.github.com> Date: Fri, 6 Jun 2025 05:32:59 +0300 Subject: [PATCH] Fix ReadableStream cancel error message (#37282) Align error message with WHATWG Streams spec by changing: - `'stream is not locked'` to `'stream is locked'` This will match the step 2 of the readablestream cancel method that requires the correct TypeError when the stream is locked. Signed-off-by: Alice Okingo --- components/script/dom/readablestream.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/script/dom/readablestream.rs b/components/script/dom/readablestream.rs index d2c1d853f86..5203a5f0a83 100644 --- a/components/script/dom/readablestream.rs +++ b/components/script/dom/readablestream.rs @@ -1926,7 +1926,7 @@ impl ReadableStreamMethods for ReadableStream { // If ! IsReadableStreamLocked(this) is true, // return a promise rejected with a TypeError exception. let promise = Promise::new(&global, can_gc); - promise.reject_error(Error::Type("stream is not locked".to_owned()), can_gc); + promise.reject_error(Error::Type("stream is locked".to_owned()), can_gc); promise } else { // Return ! ReadableStreamCancel(this, reason).