Skip to content

Commit

Permalink
Fix Object constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
raskad committed Mar 20, 2023
1 parent 7e6d3c9 commit e1075b9
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion boa_engine/src/builtins/object/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,11 @@ impl BuiltInConstructor for Object {
context: &mut Context<'_>,
) -> JsResult<JsValue> {
// 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)?;
Expand Down

0 comments on commit e1075b9

Please sign in to comment.