Reviewers: danno,

Description:
Version 3.29.88.10 (merged r24706, r24708)

Don't expose Array.prototype.values as it breaks webcompat

Fix webkit getOwnPropertyNames test after r24706 removed Array.prototype.values

BUG=chromium:409858
LOG=N
[email protected]

Please review this at https://codereview.chromium.org/667033002/

Base URL: https://v8.googlecode.com/svn/branches/3.29

Affected files (+23, -27 lines):
  M src/array.js
  M src/array-iterator.js
  M src/version.cc
  M test/mjsunit/es6/arguments-iterator.js
  M test/mjsunit/es6/array-iterator.js
  M test/mjsunit/es6/typed-array-iterator.js
  M test/webkit/fast/js/Object-getOwnPropertyNames.js
  M test/webkit/fast/js/Object-getOwnPropertyNames-expected.txt


Index: src/array-iterator.js
diff --git a/src/array-iterator.js b/src/array-iterator.js
index 82779bc22872f60a4ff6cbf08909d10822d660ec..5ced9da17cf5f654bd27e7031734743277260054 100644
--- a/src/array-iterator.js
+++ b/src/array-iterator.js
@@ -120,8 +120,8 @@ function ExtendArrayPrototype() {
   %CheckIsBootstrapping();

   InstallFunctions($Array.prototype, DONT_ENUM, $Array(
+    // No 'values' since it breaks webcompat: http://crbug.com/409858
     'entries', ArrayEntries,
-    'values', ArrayValues,
     'keys', ArrayKeys
   ));

Index: src/array.js
diff --git a/src/array.js b/src/array.js
index 44deff7de42c60986741615b1be389f9668dbf85..81f1f65ef860953516b8cdd1323254dc00543ac1 100644
--- a/src/array.js
+++ b/src/array.js
@@ -1481,7 +1481,6 @@ function SetUpArray() {
     find: true,
     findIndex: true,
     keys: true,
-    values: true,
   };
   %AddNamedProperty($Array.prototype, symbolUnscopables, unscopables,
       DONT_ENUM | READ_ONLY);
Index: src/version.cc
diff --git a/src/version.cc b/src/version.cc
index 376a08bd12d6df55f221baece4d7e31d42dcb333..dc44f9297c4fcac8e21f3c773371d8a22f276aec 100644
--- a/src/version.cc
+++ b/src/version.cc
@@ -35,7 +35,7 @@
 #define MAJOR_VERSION     3
 #define MINOR_VERSION     29
 #define BUILD_NUMBER      88
-#define PATCH_LEVEL       9
+#define PATCH_LEVEL       10
 // Use 1 for candidates and 0 otherwise.
 // (Boolean macro values are not supported by all preprocessors.)
 #define IS_CANDIDATE_VERSION 0
Index: test/mjsunit/es6/arguments-iterator.js
diff --git a/test/mjsunit/es6/arguments-iterator.js b/test/mjsunit/es6/arguments-iterator.js index a65bf8bad5d6350110e3397ab9deec60a2cde998..32d4b11ee1f58427dca47bfc6a8496ad3f3e8c8b 100644
--- a/test/mjsunit/es6/arguments-iterator.js
+++ b/test/mjsunit/es6/arguments-iterator.js
@@ -16,8 +16,8 @@ function TestDirectArgumentsIteratorProperty() {
   assertTrue(descriptor.writable);
   assertFalse(descriptor.enumerable);
   assertTrue(descriptor.configurable);
-  assertEquals(descriptor.value, [].values);
-  assertEquals(arguments[Symbol.iterator], [].values);
+  assertEquals(descriptor.value, [][Symbol.iterator]);
+  assertEquals(arguments[Symbol.iterator], [][Symbol.iterator]);
 }
 TestDirectArgumentsIteratorProperty();

@@ -26,7 +26,7 @@ function TestIndirectArgumentsIteratorProperty() {
   var o = arguments;
   assertTrue(o.hasOwnProperty(Symbol.iterator));
   assertFalse(o.propertyIsEnumerable(Symbol.iterator));
-  assertEquals(o[Symbol.iterator], [].values);
+  assertEquals(o[Symbol.iterator], [][Symbol.iterator]);
 }
 TestIndirectArgumentsIteratorProperty();

@@ -204,27 +204,27 @@ function TestArgumentsAsProto() {
   "use strict";

   var o = {__proto__:arguments};
-  assertSame([].values, o[Symbol.iterator]);
+  assertSame([][Symbol.iterator], o[Symbol.iterator]);
   // Make o dict-mode.
   %OptimizeObjectForAddingMultipleProperties(o, 0);
   assertFalse(o.hasOwnProperty(Symbol.iterator));
-  assertSame([].values, o[Symbol.iterator]);
+  assertSame([][Symbol.iterator], o[Symbol.iterator]);
   o[Symbol.iterator] = 10;
   assertTrue(o.hasOwnProperty(Symbol.iterator));
   assertEquals(10, o[Symbol.iterator]);
-  assertSame([].values, arguments[Symbol.iterator]);
+  assertSame([][Symbol.iterator], arguments[Symbol.iterator]);

   // Frozen o.
   o = Object.freeze({__proto__:arguments});
-  assertSame([].values, o[Symbol.iterator]);
+  assertSame([][Symbol.iterator], o[Symbol.iterator]);
   assertFalse(o.hasOwnProperty(Symbol.iterator));
-  assertSame([].values, o[Symbol.iterator]);
+  assertSame([][Symbol.iterator], o[Symbol.iterator]);
   // This should throw, but currently it doesn't, because
   // ExecutableAccessorInfo callbacks don't see the current strict mode.
   // See note in accessors.cc:SetPropertyOnInstanceIfInherited.
   o[Symbol.iterator] = 10;
   assertFalse(o.hasOwnProperty(Symbol.iterator));
-  assertEquals([].values, o[Symbol.iterator]);
-  assertSame([].values, arguments[Symbol.iterator]);
+  assertEquals([][Symbol.iterator], o[Symbol.iterator]);
+  assertSame([][Symbol.iterator], arguments[Symbol.iterator]);
 }
 TestArgumentsAsProto();
Index: test/mjsunit/es6/array-iterator.js
diff --git a/test/mjsunit/es6/array-iterator.js b/test/mjsunit/es6/array-iterator.js index b24ee5712fb71c595014189b2258a776e80381a7..96122cd9999941155e457a6b664c917389512c13 100644
--- a/test/mjsunit/es6/array-iterator.js
+++ b/test/mjsunit/es6/array-iterator.js
@@ -45,11 +45,8 @@ function assertHasOwnProperty(object, name, attrs) {

 function TestArrayPrototype() {
   assertHasOwnProperty(Array.prototype, 'entries', DONT_ENUM);
-  assertHasOwnProperty(Array.prototype, 'values', DONT_ENUM);
   assertHasOwnProperty(Array.prototype, 'keys', DONT_ENUM);
   assertHasOwnProperty(Array.prototype, Symbol.iterator, DONT_ENUM);
-
-  assertEquals(Array.prototype.values, Array.prototype[Symbol.iterator]);
 }
 TestArrayPrototype();

@@ -61,7 +58,7 @@ function assertIteratorResult(value, done, result) {

 function TestValues() {
   var array = ['a', 'b', 'c'];
-  var iterator = array.values();
+  var iterator = array[Symbol.iterator]();
   assertIteratorResult('a', false, iterator.next());
   assertIteratorResult('b', false, iterator.next());
   assertIteratorResult('c', false, iterator.next());
@@ -75,7 +72,7 @@ TestValues();

 function TestValuesMutate() {
   var array = ['a', 'b', 'c'];
-  var iterator = array.values();
+  var iterator = array[Symbol.iterator]();
   assertIteratorResult('a', false, iterator.next());
   assertIteratorResult('b', false, iterator.next());
   assertIteratorResult('c', false, iterator.next());
@@ -142,17 +139,17 @@ TestEntriesMutate();

 function TestArrayIteratorPrototype() {
   var array = [];
-  var iterator = array.values();
+  var iterator = array.keys();

   var ArrayIteratorPrototype = iterator.__proto__;

-  assertEquals(ArrayIteratorPrototype, array.values().__proto__);
+  assertEquals(ArrayIteratorPrototype, array[Symbol.iterator]().__proto__);
   assertEquals(ArrayIteratorPrototype, array.keys().__proto__);
   assertEquals(ArrayIteratorPrototype, array.entries().__proto__);

   assertEquals(Object.prototype, ArrayIteratorPrototype.__proto__);

-  assertEquals('Array Iterator', %_ClassOf(array.values()));
+  assertEquals('Array Iterator', %_ClassOf(array[Symbol.iterator]()));
   assertEquals('Array Iterator', %_ClassOf(array.keys()));
   assertEquals('Array Iterator', %_ClassOf(array.entries()));

@@ -169,7 +166,7 @@ function TestForArrayValues() {
   var buffer = [];
   var array = [0, 'a', true, false, null, /* hole */, undefined, NaN];
   var i = 0;
-  for (var value of array.values()) {
+  for (var value of array[Symbol.iterator]()) {
     buffer[i++] = value;
   }

@@ -239,7 +236,7 @@ TestForArrayValues();

 function TestNonOwnSlots() {
   var array = [0];
-  var iterator = array.values();
+  var iterator = array[Symbol.iterator]();
   var object = {__proto__: iterator};

   assertThrows(function() {
Index: test/mjsunit/es6/typed-array-iterator.js
diff --git a/test/mjsunit/es6/typed-array-iterator.js b/test/mjsunit/es6/typed-array-iterator.js index a2e4906c191c7b81137052da7e027aea15185c3c..9903b0abaee75cb4cda98b246d5899f9d50450b0 100644
--- a/test/mjsunit/es6/typed-array-iterator.js
+++ b/test/mjsunit/es6/typed-array-iterator.js
@@ -21,9 +21,9 @@ function TestTypedArrayPrototype(constructor) {
   assertFalse(constructor.prototype.propertyIsEnumerable(Symbol.iterator));

   assertEquals(Array.prototype.entries, constructor.prototype.entries);
-  assertEquals(Array.prototype.values, constructor.prototype.values);
+ assertEquals(Array.prototype[Symbol.iterator], constructor.prototype.values);
   assertEquals(Array.prototype.keys, constructor.prototype.keys);
- assertEquals(Array.prototype.values, constructor.prototype[Symbol.iterator]); + assertEquals(Array.prototype[Symbol.iterator], constructor.prototype[Symbol.iterator]);
 }
 constructors.forEach(TestTypedArrayPrototype);

Index: test/webkit/fast/js/Object-getOwnPropertyNames-expected.txt
diff --git a/test/webkit/fast/js/Object-getOwnPropertyNames-expected.txt b/test/webkit/fast/js/Object-getOwnPropertyNames-expected.txt index 4fe6742d0060f423f1965c17a34522870efb1416..030d7f9c7d0b1c8705388aae4b642096f44c4ab9 100644
--- a/test/webkit/fast/js/Object-getOwnPropertyNames-expected.txt
+++ b/test/webkit/fast/js/Object-getOwnPropertyNames-expected.txt
@@ -68,7 +68,7 @@ PASS getSortedOwnPropertyNames(Object.prototype) is ['__defineGetter__', '__defi PASS getSortedOwnPropertyNames(Function) is ['arguments', 'caller', 'length', 'name', 'prototype'] PASS getSortedOwnPropertyNames(Function.prototype) is ['apply', 'arguments', 'bind', 'call', 'caller', 'constructor', 'length', 'name', 'toString'] PASS getSortedOwnPropertyNames(Array) is ['arguments', 'caller', 'isArray', 'length', 'name', 'observe', 'prototype', 'unobserve'] -PASS getSortedOwnPropertyNames(Array.prototype) is ['concat', 'constructor', 'entries', 'every', 'filter', 'forEach', 'indexOf', 'join', 'keys', 'lastIndexOf', 'length', 'map', 'pop', 'push', 'reduce', 'reduceRight', 'reverse', 'shift', 'slice', 'some', 'sort', 'splice', 'toLocaleString', 'toString', 'unshift', 'values'] +PASS getSortedOwnPropertyNames(Array.prototype) is ['concat', 'constructor', 'entries', 'every', 'filter', 'forEach', 'indexOf', 'join', 'keys', 'lastIndexOf', 'length', 'map', 'pop', 'push', 'reduce', 'reduceRight', 'reverse', 'shift', 'slice', 'some', 'sort', 'splice', 'toLocaleString', 'toString', 'unshift'] PASS getSortedOwnPropertyNames(String) is ['arguments', 'caller', 'fromCharCode', 'length', 'name', 'prototype'] PASS getSortedOwnPropertyNames(String.prototype) is ['anchor', 'big', 'blink', 'bold', 'charAt', 'charCodeAt', 'concat', 'constructor', 'fixed', 'fontcolor', 'fontsize', 'indexOf', 'italics', 'lastIndexOf', 'length', 'link', 'localeCompare', 'match', 'normalize', 'replace', 'search', 'slice', 'small', 'split', 'strike', 'sub', 'substr', 'substring', 'sup', 'toLocaleLowerCase', 'toLocaleUpperCase', 'toLowerCase', 'toString', 'toUpperCase', 'trim', 'trimLeft', 'trimRight', 'valueOf'] PASS getSortedOwnPropertyNames(Boolean) is ['arguments', 'caller', 'length', 'name', 'prototype']
Index: test/webkit/fast/js/Object-getOwnPropertyNames.js
diff --git a/test/webkit/fast/js/Object-getOwnPropertyNames.js b/test/webkit/fast/js/Object-getOwnPropertyNames.js index c168c37b0edce438820993995cce55db2195ed02..caa0111fe1a12d336dd64c4e872599b3d664c764 100644
--- a/test/webkit/fast/js/Object-getOwnPropertyNames.js
+++ b/test/webkit/fast/js/Object-getOwnPropertyNames.js
@@ -76,7 +76,7 @@ var expectedPropertyNamesSet = {
     "Function": "['arguments', 'caller', 'length', 'name', 'prototype']",
     "Function.prototype": "['apply', 'arguments', 'bind', 'call', 'caller', 
'constructor', 'length', 'name', 'toString']",
     "Array": "['arguments', 'caller', 'isArray', 'length', 'name', 'observe', 
'prototype', 'unobserve']",
-    "Array.prototype": "['concat', 'constructor', 'entries', 'every', 'filter', 
'forEach', 'indexOf', 'join', 'keys', 'lastIndexOf', 'length', 'map', 'pop', 'push', 'reduce', 
'reduceRight', 'reverse', 'shift', 'slice', 'some', 'sort', 'splice', 'toLocaleString', 'toString', 
'unshift', 'values']",
+    "Array.prototype": "['concat', 'constructor', 'entries', 'every', 'filter', 
'forEach', 'indexOf', 'join', 'keys', 'lastIndexOf', 'length', 'map', 'pop', 'push', 'reduce', 
'reduceRight', 'reverse', 'shift', 'slice', 'some', 'sort', 'splice', 'toLocaleString', 'toString', 
'unshift']",
     "String": "['arguments', 'caller', 'fromCharCode', 'length', 'name', 
'prototype']",
     "String.prototype": "['anchor', 'big', 'blink', 'bold', 'charAt', 'charCodeAt', 
'concat', 'constructor', 'fixed', 'fontcolor', 'fontsize', 'indexOf', 'italics', 'lastIndexOf', 
'length', 'link', 'localeCompare', 'match', 'normalize', 'replace', 'search', 'slice', 'small', 
'split', 'strike', 'sub', 'substr', 'substring', 'sup', 'toLocaleLowerCase', 'toLocaleUpperCase', 
'toLowerCase', 'toString', 'toUpperCase', 'trim', 'trimLeft', 'trimRight', 'valueOf']",
     "Boolean": "['arguments', 'caller', 'length', 'name', 'prototype']",


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to