Bug 1415489 - Use SingletonObject for Array.prototype[@@unscopables]. r=bhackett
authorJan de Mooij <jdemooij@mozilla.com>
Sat, 11 Nov 2017 13:32:56 +0100
changeset 696847 9b5afe75d13f7cf77c9766d0a75f0faabd83a090
parent 696846 d352680181fc5034f86fa7658ca2d49d87ad7f79
child 696848 e2dc5d006fc76e2e013d0d07a9707c20c2b3227c
push id88807
push userbmo:ato@sny.no
push dateSun, 12 Nov 2017 01:46:20 +0000
reviewersbhackett
bugs1415489
milestone58.0a1
Bug 1415489 - Use SingletonObject for Array.prototype[@@unscopables]. r=bhackett
js/src/jsarray.cpp
--- a/js/src/jsarray.cpp
+++ b/js/src/jsarray.cpp
@@ -3668,17 +3668,18 @@ CreateArrayPrototype(JSContext* cx, JSPr
 
     return arrayProto;
 }
 
 static bool
 array_proto_finish(JSContext* cx, JS::HandleObject ctor, JS::HandleObject proto)
 {
     // Add Array.prototype[@@unscopables]. ECMA-262 draft (2016 Mar 19) 22.1.3.32.
-    RootedObject unscopables(cx, NewObjectWithGivenProto<PlainObject>(cx, nullptr, TenuredObject));
+    RootedObject unscopables(cx, NewObjectWithGivenProto<PlainObject>(cx, nullptr,
+                                                                      SingletonObject));
     if (!unscopables)
         return false;
 
     RootedValue value(cx, BooleanValue(true));
     if (!DefineDataProperty(cx, unscopables, cx->names().copyWithin, value) ||
         !DefineDataProperty(cx, unscopables, cx->names().entries, value) ||
         !DefineDataProperty(cx, unscopables, cx->names().fill, value) ||
         !DefineDataProperty(cx, unscopables, cx->names().find, value) ||