Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Merged by Bors] - %NativeError%.[[prototype]] should be Error constructor #1883

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions boa_engine/src/builtins/error/eval.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ impl BuiltIn for EvalError {
fn init(context: &mut Context) -> JsValue {
let _timer = Profiler::global().start_event(Self::NAME, "init");

let error_constructor = context.standard_objects().error_object().constructor();
let error_prototype = context.standard_objects().error_object().prototype();

let attribute = Attribute::WRITABLE | Attribute::NON_ENUMERABLE | Attribute::CONFIGURABLE;
let eval_error_object = ConstructorBuilder::with_standard_object(
context,
Expand All @@ -48,6 +50,7 @@ impl BuiltIn for EvalError {
.name(Self::NAME)
.length(Self::LENGTH)
.inherit(error_prototype)
.custom_prototype(error_constructor)
.property("name", Self::NAME, attribute)
.property("message", "", attribute)
.build();
Expand Down
3 changes: 3 additions & 0 deletions boa_engine/src/builtins/error/range.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ impl BuiltIn for RangeError {
fn init(context: &mut Context) -> JsValue {
let _timer = Profiler::global().start_event(Self::NAME, "init");

let error_constructor = context.standard_objects().error_object().constructor();
let error_prototype = context.standard_objects().error_object().prototype();

let attribute = Attribute::WRITABLE | Attribute::NON_ENUMERABLE | Attribute::CONFIGURABLE;
let range_error_object = ConstructorBuilder::with_standard_object(
context,
Expand All @@ -46,6 +48,7 @@ impl BuiltIn for RangeError {
.name(Self::NAME)
.length(Self::LENGTH)
.inherit(error_prototype)
.custom_prototype(error_constructor)
.property("name", Self::NAME, attribute)
.property("message", "", attribute)
.build();
Expand Down
3 changes: 3 additions & 0 deletions boa_engine/src/builtins/error/reference.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ impl BuiltIn for ReferenceError {
fn init(context: &mut Context) -> JsValue {
let _timer = Profiler::global().start_event(Self::NAME, "init");

let error_constructor = context.standard_objects().error_object().constructor();
let error_prototype = context.standard_objects().error_object().prototype();

let attribute = Attribute::WRITABLE | Attribute::NON_ENUMERABLE | Attribute::CONFIGURABLE;
let reference_error_object = ConstructorBuilder::with_standard_object(
context,
Expand All @@ -45,6 +47,7 @@ impl BuiltIn for ReferenceError {
.name(Self::NAME)
.length(Self::LENGTH)
.inherit(error_prototype)
.custom_prototype(error_constructor)
.property("name", Self::NAME, attribute)
.property("message", "", attribute)
.build();
Expand Down
3 changes: 3 additions & 0 deletions boa_engine/src/builtins/error/syntax.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ impl BuiltIn for SyntaxError {
fn init(context: &mut Context) -> JsValue {
let _timer = Profiler::global().start_event(Self::NAME, "init");

let error_constructor = context.standard_objects().error_object().constructor();
let error_prototype = context.standard_objects().error_object().prototype();

let attribute = Attribute::WRITABLE | Attribute::NON_ENUMERABLE | Attribute::CONFIGURABLE;
let syntax_error_object = ConstructorBuilder::with_standard_object(
context,
Expand All @@ -48,6 +50,7 @@ impl BuiltIn for SyntaxError {
.name(Self::NAME)
.length(Self::LENGTH)
.inherit(error_prototype)
.custom_prototype(error_constructor)
.property("name", Self::NAME, attribute)
.property("message", "", attribute)
.build();
Expand Down
3 changes: 3 additions & 0 deletions boa_engine/src/builtins/error/type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ impl BuiltIn for TypeError {
fn init(context: &mut Context) -> JsValue {
let _timer = Profiler::global().start_event(Self::NAME, "init");

let error_constructor = context.standard_objects().error_object().constructor();
let error_prototype = context.standard_objects().error_object().prototype();

let attribute = Attribute::WRITABLE | Attribute::NON_ENUMERABLE | Attribute::CONFIGURABLE;
let type_error_object = ConstructorBuilder::with_standard_object(
context,
Expand All @@ -52,6 +54,7 @@ impl BuiltIn for TypeError {
.name(Self::NAME)
.length(Self::LENGTH)
.inherit(error_prototype)
.custom_prototype(error_constructor)
.property("name", Self::NAME, attribute)
.property("message", "", attribute)
.build();
Expand Down
3 changes: 3 additions & 0 deletions boa_engine/src/builtins/error/uri.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ impl BuiltIn for UriError {
fn init(context: &mut Context) -> JsValue {
let _timer = Profiler::global().start_event(Self::NAME, "init");

let error_constructor = context.standard_objects().error_object().constructor();
let error_prototype = context.standard_objects().error_object().prototype();

let attribute = Attribute::WRITABLE | Attribute::NON_ENUMERABLE | Attribute::CONFIGURABLE;
let uri_error_object = ConstructorBuilder::with_standard_object(
context,
Expand All @@ -47,6 +49,7 @@ impl BuiltIn for UriError {
.name(Self::NAME)
.length(Self::LENGTH)
.inherit(error_prototype)
.custom_prototype(error_constructor)
.property("name", Self::NAME, attribute)
.property("message", "", attribute)
.build();
Expand Down