Browse Source

Fix panic in constructor call (#3001)

pull/3002/head
raskad 1 year ago committed by GitHub
parent
commit
c9a7bdcab8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      boa_engine/src/vm/code_block.rs
  2. 15
      boa_engine/src/vm/tests.rs

3
boa_engine/src/vm/code_block.rs

@ -1405,10 +1405,11 @@ impl JsObject {
); );
if code.has_parameters_env_bindings() { if code.has_parameters_env_bindings() {
last_env -= 1;
context context
.vm .vm
.environments .environments
.push_lexical(code.compile_environments[0].clone()); .push_lexical(code.compile_environments[last_env].clone());
} }
// Taken from: `FunctionDeclarationInstantiation` abstract function. // Taken from: `FunctionDeclarationInstantiation` abstract function.

15
boa_engine/src/vm/tests.rs

@ -309,3 +309,18 @@ fn recursion_runtime_limit() {
), ),
]); ]);
} }
#[test]
fn arguments_object_constructor_valid_index() {
run_test_actions([TestAction::assert_eq(
indoc! {r#"
let args;
function F(a = 1) {
args = arguments;
}
new F();
typeof args
"#},
"object",
)]);
}

Loading…
Cancel
Save