Browse Source

Fix 532, 533, 641 (#642)

pull/645/head
54k1 4 years ago committed by GitHub
parent
commit
7a51530dcd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      boa/src/exec/mod.rs
  2. 7
      boa/src/exec/tests.rs

4
boa/src/exec/mod.rs

@ -148,6 +148,10 @@ impl Interpreter {
let new_func = Object::function(func, function_prototype);
let val = Value::from(new_func);
// Set constructor field to the newly created Value (function object)
proto.set_field("constructor", val.clone());
val.set_field(PROTOTYPE, proto);
val.set_field("length", Value::from(params_len));

7
boa/src/exec/tests.rs

@ -766,8 +766,11 @@ mod in_operator {
var bar = new Foo();
"#;
forward(&mut engine, scenario);
let a = forward_val(&mut engine, "bar").unwrap();
assert!(a.as_object().unwrap().prototype().is_object());
let bar_val = forward_val(&mut engine, "bar").unwrap();
let bar_obj = bar_val.as_object().unwrap();
let foo_val = forward_val(&mut engine, "Foo").unwrap();
let foo_obj = foo_val.as_object().unwrap();
assert!(bar_obj.prototype().strict_equals(&foo_obj.get_field("prototype").unwrap()));
}
}

Loading…
Cancel
Save