diff --git a/boa/src/builtins/json/tests.rs b/boa/src/builtins/json/tests.rs index d09eff8c28..8a2f2dc1cd 100644 --- a/boa/src/builtins/json/tests.rs +++ b/boa/src/builtins/json/tests.rs @@ -336,8 +336,9 @@ fn json_parse_array_with_reviver() { if (typeof v == 'number') { return v * 2; } else { - v - }})"#, + return v; + } + })"#, ) .unwrap(); assert_eq!( diff --git a/boa/src/object/gcobject.rs b/boa/src/object/gcobject.rs index 0664a79c0e..38ea1d5b78 100644 --- a/boa/src/object/gcobject.rs +++ b/boa/src/object/gcobject.rs @@ -327,8 +327,11 @@ impl JsObject { // 14. Return ? constructorEnv.GetThisBinding(). this - } else { + } else if context.executor().get_current_state() == &InterpreterState::Return { result + } else { + result?; + Ok(JsValue::undefined()) } } }