|
|
@ -41,7 +41,12 @@ impl BuiltIn for Json { |
|
|
|
fn init(context: &mut Context) -> (&'static str, Value, Attribute) { |
|
|
|
fn init(context: &mut Context) -> (&'static str, Value, Attribute) { |
|
|
|
let _timer = BoaProfiler::global().start_event(Self::NAME, "init"); |
|
|
|
let _timer = BoaProfiler::global().start_event(Self::NAME, "init"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let to_string_tag = context.well_known_symbols().to_string_tag_symbol(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let attribute = Attribute::READONLY | Attribute::NON_ENUMERABLE | Attribute::CONFIGURABLE; |
|
|
|
|
|
|
|
|
|
|
|
let json_object = ObjectInitializer::new(context) |
|
|
|
let json_object = ObjectInitializer::new(context) |
|
|
|
|
|
|
|
.property(to_string_tag, "JSON", attribute) |
|
|
|
.function(Self::parse, "parse", 2) |
|
|
|
.function(Self::parse, "parse", 2) |
|
|
|
.function(Self::stringify, "stringify", 3) |
|
|
|
.function(Self::stringify, "stringify", 3) |
|
|
|
.build(); |
|
|
|
.build(); |
|
|
|