Bug 1299593 - Disable Array.prototype.values outside Nightly. r=jorendorff, r=smaug, a=ritu
authorTom Schuster <evilpies@gmail.com>
Wed, 21 Sep 2016 11:53:00 -0400
changeset 350379 754de22b392f0c9e0e36aeb8d45c5427fa84c20b
parent 350378 ac2c88544d05b1b320db08472496de5bb16c8b60
child 350380 781b860baf29469bf879a2a575a2c0f9cea14908
push id1230
push userjlund@mozilla.com
push dateMon, 31 Oct 2016 18:13:35 +0000
treeherdermozilla-release@5e06e3766db2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjorendorff, smaug, ritu
bugs1299593
milestone50.0
Bug 1299593 - Disable Array.prototype.values outside Nightly. r=jorendorff, r=smaug, a=ritu
js/src/jsarray.cpp
js/src/tests/ecma_6/Array/values.js
js/xpconnect/tests/chrome/test_xrayToJS.xul
testing/web-platform/tests/dom/lists/DOMTokenList-iteration.html
testing/web-platform/tests/dom/nodes/Node-childNodes.html
--- 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
@@ -191,17 +191,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"];
--- a/testing/web-platform/tests/dom/lists/DOMTokenList-iteration.html
+++ b/testing/web-platform/tests/dom/lists/DOMTokenList-iteration.html
@@ -36,13 +36,15 @@
       assert_equals(value, values[cur]);
       assert_equals(key, keys[cur]);
       cur++;
     }, thisObj);
     assert_equals(cur, entries.length);
 
     assert_equals(list[Symbol.iterator], Array.prototype[Symbol.iterator]);
     assert_equals(list.keys, Array.prototype.keys);
-    assert_equals(list.values, Array.prototype.values);
+    if (Array.prototype.values) {
+      assert_equals(list.values, Array.prototype.values);
+    }
     assert_equals(list.entries, Array.prototype.entries);
     assert_equals(list.forEach, Array.prototype.forEach);
   });
 </script>
--- a/testing/web-platform/tests/dom/nodes/Node-childNodes.html
+++ b/testing/web-platform/tests/dom/nodes/Node-childNodes.html
@@ -85,13 +85,15 @@ test(function() {
     assert_equals(value, values[cur]);
     assert_equals(key, keys[cur]);
     cur++;
   }, thisObj);
   assert_equals(cur, entries.length);
 
   assert_equals(list[Symbol.iterator], Array.prototype[Symbol.iterator]);
   assert_equals(list.keys, Array.prototype.keys);
-  assert_equals(list.values, Array.prototype.values);
+  if (Array.prototype.values) {
+    assert_equals(list.values, Array.prototype.values);
+  }
   assert_equals(list.entries, Array.prototype.entries);
   assert_equals(list.forEach, Array.prototype.forEach);
 }, "Iterator behavior of Node.childNodes");
 </script>