Bug 1185106 - Part 14: Add AsyncFunction.prototype[@@toStringTag]. r=till
authorTooru Fujisawa <arai_a@mac.com>
Mon, 31 Oct 2016 05:33:16 +0900
changeset 346946 8fae1fb3e02eef78e34aeafb662cbc54496521e1
parent 346945 6b10479b988db3c3d668611ed75791424503afd2
child 346947 8b1eba1a5a1fb8b364bc2b48b502401f57e23eb9
push id10298
push userraliiev@mozilla.com
push dateMon, 14 Nov 2016 12:33:03 +0000
treeherdermozilla-aurora@7e29173b1641 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstill
bugs1185106
milestone52.0a1
Bug 1185106 - Part 14: Add AsyncFunction.prototype[@@toStringTag]. r=till
js/src/tests/ecma_6/Symbol/toStringTag.js
js/src/vm/AsyncFunction.cpp
--- a/js/src/tests/ecma_6/Symbol/toStringTag.js
+++ b/js/src/tests/ecma_6/Symbol/toStringTag.js
@@ -144,9 +144,12 @@ testDefault(JSON, "JSON");
 testDefault(function* () {}.constructor.prototype, "GeneratorFunction");
 
 // ES6 25.3.1.5 Generator.prototype [ @@toStringTag ]
 testDefault(function* () {}().__proto__.__proto__, "Generator");
 
 // ES6 25.4.5.4 Promise.prototype [ @@toStringTag ]
 testDefault(Promise.prototype, "Promise");
 
+// AsyncFunction.prototype [ @@toStringTag ]
+testDefault(async function() {}.constructor.prototype, "AsyncFunction");
+
 reportCompare(true, true);
--- a/js/src/vm/AsyncFunction.cpp
+++ b/js/src/vm/AsyncFunction.cpp
@@ -20,16 +20,19 @@ GlobalObject::initAsyncFunction(JSContex
 {
     if (global->getReservedSlot(ASYNC_FUNCTION_PROTO).isObject())
         return true;
 
     RootedObject asyncFunctionProto(cx, NewSingletonObjectWithFunctionPrototype(cx, global));
     if (!asyncFunctionProto)
         return false;
 
+    if (!DefineToStringTag(cx, asyncFunctionProto, cx->names().AsyncFunction))
+        return false;
+
     RootedValue function(cx, global->getConstructor(JSProto_Function));
     if (!function.toObjectOrNull())
         return false;
     RootedObject proto(cx, &function.toObject());
     RootedAtom name(cx, cx->names().AsyncFunction);
     RootedObject asyncFunction(cx, NewFunctionWithProto(cx, AsyncFunctionConstructor, 1,
                                                         JSFunction::NATIVE_CTOR, nullptr, name,
                                                         proto));