fix writablestream assertion crash when getting chunk size following spec change (#36566)

One-line change to align with the new spec and avoid a crash.
fix #36565

Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com>
This commit is contained in:
Taym Haddadi 2025-04-16 14:26:38 -04:00 committed by GitHub
parent 5aabe1aa72
commit f2ee40e40b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 3 additions and 9 deletions

View file

@ -851,13 +851,13 @@ impl WritableStreamDefaultController {
chunk: SafeHandleValue, chunk: SafeHandleValue,
can_gc: CanGc, can_gc: CanGc,
) -> f64 { ) -> f64 {
// If controller.[[strategySizeAlgorithm]] is undefined, // If controller.[[strategySizeAlgorithm]] is undefined, then:
let Some(strategy_size) = self.strategy_size.borrow().clone() else { let Some(strategy_size) = self.strategy_size.borrow().clone() else {
// Assert: controller.[[stream]].[[state]] is "erroring" or "errored". // Assert: controller.[[stream]].[[state]] is not "writable".
let Some(stream) = self.stream.get() else { let Some(stream) = self.stream.get() else {
unreachable!("Controller should have a stream"); unreachable!("Controller should have a stream");
}; };
assert!(stream.is_erroring() || stream.is_errored()); assert!(!stream.is_writable());
// Return 1. // Return 1.
return 1.0; return 1.0;

View file

@ -21,9 +21,3 @@
[close.any.shadowrealm-in-shadowrealm.html] [close.any.shadowrealm-in-shadowrealm.html]
expected: ERROR expected: ERROR
[close.any.worker.html]
expected: CRASH
[close.any.html]
expected: CRASH