Bug 1299593 - Disable Array.prototype.values outside Nightly. r=jorendorff, r=smaug, a=lizzard
authorTom Schuster <evilpies@gmail.com>
Wed, 21 Sep 2016 11:53:00 -0400
changeset 354985 21e18a93670e12cea1b71a9e69a20e336a438a78
parent 354984 21a1f994f8c0cfaba50079faedac8b7fc4e55255
child 354986 7339d82b4a5db780c3678964f1354152666c0783
push id6908
push userraliiev@mozilla.com
push dateMon, 27 Feb 2017 16:57:28 +0000
treeherdermozilla-esr52@a5c63e3e18c9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjorendorff, smaug, lizzard
bugs1299593
milestone49.0.2
Bug 1299593 - Disable Array.prototype.values outside Nightly. r=jorendorff, r=smaug, a=lizzard
js/src/jsarray.cpp
js/src/tests/ecma_6/Array/values.js
js/xpconnect/tests/chrome/test_xrayToJS.xul
--- a/js/src/jsarray.cpp
+++ b/js/src/jsarray.cpp
@@ -3131,17 +3131,19 @@ static const JSFunctionSpec array_method
     JS_SELF_HOSTED_FN("findIndex",   "ArrayFindIndex",   1,0),
     JS_SELF_HOSTED_FN("copyWithin",  "ArrayCopyWithin",  3,0),
 
     JS_SELF_HOSTED_FN("fill",        "ArrayFill",        3,0),
 
     JS_SELF_HOSTED_SYM_FN(iterator,  "ArrayValues",      0,0),
     JS_SELF_HOSTED_FN("entries",     "ArrayEntries",     0,0),
     JS_SELF_HOSTED_FN("keys",        "ArrayKeys",        0,0),
+#ifdef NIGHTLY_BUILD
     JS_SELF_HOSTED_FN("values",      "ArrayValues",      0,0),
+#endif
 
     /* ES7 additions */
     JS_SELF_HOSTED_FN("includes",    "ArrayIncludes",    2,0),
     JS_FS_END
 };
 
 static const JSFunctionSpec array_static_methods[] = {
     JS_INLINABLE_FN("isArray",       array_isArray,        1,0, ArrayIsArray),
--- a/js/src/tests/ecma_6/Array/values.js
+++ b/js/src/tests/ecma_6/Array/values.js
@@ -1,18 +1,20 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/licenses/publicdomain/ */
 
-assertEq(Array.prototype.values, Array.prototype[Symbol.iterator]);
-assertEq(Array.prototype.values.name, "values");
-assertEq(Array.prototype.values.length, 0);
+if (Array.prototype.values) {
+    assertEq(Array.prototype.values, Array.prototype[Symbol.iterator]);
+    assertEq(Array.prototype.values.name, "values");
+    assertEq(Array.prototype.values.length, 0);
 
-function valuesUnscopeable() {
-    var values = "foo";
-    with ([1, 2, 3]) {
-        assertEq(indexOf, Array.prototype.indexOf);
-        assertEq(values, "foo");
+    function valuesUnscopeable() {
+        var values = "foo";
+        with ([1, 2, 3]) {
+            assertEq(indexOf, Array.prototype.indexOf);
+            assertEq(values, "foo");
+        }
     }
+    valuesUnscopeable();
 }
-valuesUnscopeable();
 
 if (typeof reportCompare === 'function')
     reportCompare(0, 0);
--- a/js/xpconnect/tests/chrome/test_xrayToJS.xul
+++ b/js/xpconnect/tests/chrome/test_xrayToJS.xul
@@ -177,17 +177,20 @@ https://bugzilla.mozilla.org/show_bug.cg
                       "preventExtensions", "freeze", "isFrozen", "seal",
                       "isSealed", "assign", "getPrototypeOf", "values",
                       "entries", "isExtensible"])
   gPrototypeProperties['Array'] =
     ["length", "toSource", "toString", "toLocaleString", "join", "reverse", "sort", "push",
       "pop", "shift", "unshift", "splice", "concat", "slice", "lastIndexOf", "indexOf",
       "includes", "forEach", "map", "reduce", "reduceRight", "filter", "some", "every", "find",
       "findIndex", "copyWithin", "fill", Symbol.iterator, Symbol.unscopables, "entries", "keys",
-      "values", "constructor"];
+      "constructor"];
+  if (isNightlyBuild) {
+    gPrototypeProperties['Array'].push("values");
+  }
   gConstructorProperties['Array'] =
     constructorProps(["join", "reverse", "sort", "push", "pop", "shift",
                       "unshift", "splice", "concat", "slice", "isArray",
                       "lastIndexOf", "indexOf", "forEach", "map", "filter",
                       "every", "some", "reduce", "reduceRight", "from", "of",
                       Symbol.species]);
   for (var c of typedArrayClasses) {
     gPrototypeProperties[c] = ["constructor", "BYTES_PER_ELEMENT"];