From e1075b907641668a2e227985851e2762fb82b427 Mon Sep 17 00:00:00 2001 From: raskad <32105367+raskad@users.noreply.github.com> Date: Mon, 20 Mar 2023 05:01:59 +0100 Subject: [PATCH] Fix Object constructor --- boa_engine/src/builtins/object/mod.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/boa_engine/src/builtins/object/mod.rs b/boa_engine/src/builtins/object/mod.rs index 02871e5ff4d..daa35e76961 100644 --- a/boa_engine/src/builtins/object/mod.rs +++ b/boa_engine/src/builtins/object/mod.rs @@ -129,7 +129,11 @@ impl BuiltInConstructor for Object { context: &mut Context<'_>, ) -> JsResult { // 1. If NewTarget is neither undefined nor the active function object, then - if !new_target.is_undefined() { + if !new_target.is_undefined() + && !new_target.as_object().map_or(false, |o| { + o.eq(&context.intrinsics().constructors().object().constructor()) + }) + { // a. Return ? OrdinaryCreateFromConstructor(NewTarget, "%Object.prototype%"). let prototype = get_prototype_from_constructor(new_target, StandardConstructors::object, context)?;