Skip to content

Truly independent web browser

LibJS: Assert that returns reach `finally` in the scope of its `try`

Tim Ledbetter67d3141dc333
diff --git a/Libraries/LibJS/Rust/src/bytecode/generator.rs b/Libraries/LibJS/Rust/src/bytecode/generator.rs
index 4adab42755a..0b0477a4af1 100644
--- a/Libraries/LibJS/Rust/src/bytecode/generator.rs
+++ b/Libraries/LibJS/Rust/src/bytecode/generator.rs
@@ -1831,6 +1831,11 @@ impl Generator {
});
}
BlockBoundaryType::ReturnToFinally => {
+ debug_assert_eq!(
+ self.current_finally_context
+ .and_then(|index| self.finally_contexts[index].lexical_environment_at_entry.as_ref()),
+ Some(&self.lexical_environment_register_stack[env_stack_offset - 1])
+ );
return;
}
_ => {}