From 0d0cfba00dd46851777e9c7682fdde44ee922c31 Mon Sep 17 00:00:00 2001 From: Haled Odat Date: Mon, 10 Apr 2023 02:04:50 +0200 Subject: [PATCH] Fix `ThrowTypeError` intrinsic --- boa_engine/src/builtins/error/type.rs | 3 ++- boa_engine/src/object/mod.rs | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/boa_engine/src/builtins/error/type.rs b/boa_engine/src/builtins/error/type.rs index d480170e516..b94786c9e5f 100644 --- a/boa_engine/src/builtins/error/type.rs +++ b/boa_engine/src/builtins/error/type.rs @@ -127,12 +127,13 @@ impl IntrinsicObject for ThrowTypeError { let obj = BuiltInBuilder::with_intrinsic::(realm) .prototype(realm.intrinsics().constructors().function().prototype()) - .static_property(utf16!("name"), "ThrowTypeError", Attribute::empty()) .static_property(utf16!("length"), 0, Attribute::empty()) + .static_property(utf16!("name"), "", Attribute::empty()) .build(); let mut obj = obj.borrow_mut(); + obj.extensible = false; obj.data = ObjectData::function(Function::new( FunctionKind::Native { function: NativeFunction::from_fn_ptr(throw_type_error), diff --git a/boa_engine/src/object/mod.rs b/boa_engine/src/object/mod.rs index 7b5f149fa85..7f38e20fa64 100644 --- a/boa_engine/src/object/mod.rs +++ b/boa_engine/src/object/mod.rs @@ -125,7 +125,7 @@ pub struct Object { /// Instance prototype `__proto__`. prototype: JsPrototype, /// Whether it can have new properties added to it. - extensible: bool, + pub(crate) extensible: bool, /// The `[[PrivateElements]]` internal slot. private_elements: ThinVec<(PrivateName, PrivateElement)>, }