Commit 584386a2 authored by verwaest's avatar verwaest Committed by Commit bot

Make sure only toStringTag is used for Object.prototype.toString with JSON / Math

BUG=

Review-Url: https://codereview.chromium.org/1992153002
Cr-Commit-Position: refs/heads/master@{#36393}
parent e17c68c4
......@@ -1587,7 +1587,6 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object,
Handle<JSFunction> cons = factory->NewFunction(name);
JSFunction::SetInstancePrototype(cons,
Handle<Object>(native_context()->initial_object_prototype(), isolate));
cons->shared()->set_instance_class_name(*name);
Handle<JSObject> json_object = factory->NewJSObject(cons, TENURED);
DCHECK(json_object->IsJSObject());
JSObject::AddProperty(global, name, json_object, DONT_ENUM);
......@@ -1599,7 +1598,6 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object,
JSFunction::SetInstancePrototype(
cons,
Handle<Object>(native_context()->initial_object_prototype(), isolate));
cons->shared()->set_instance_class_name(*name);
Handle<JSObject> math = factory->NewJSObject(cons, TENURED);
DCHECK(math->IsJSObject());
JSObject::AddProperty(global, name, math, DONT_ENUM);
......
......@@ -9,5 +9,7 @@ function testJSONToString() {
assertTrue(desc.configurable);
assertFalse(desc.writable);
assertEquals("JSON", desc.value);
delete JSON[Symbol.toStringTag];
assertEquals('[object Object]', "" + JSON);
}
testJSONToString();
......@@ -9,5 +9,7 @@ function testMathToString() {
assertTrue(desc.configurable);
assertFalse(desc.writable);
assertEquals("Math", desc.value);
delete Math[Symbol.toStringTag];
assertEquals('[object Object]', "" + Math);
}
testMathToString();
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment