Title: [267912] trunk
Revision
267912
Author
[email protected]
Date
2020-10-02 18:46:41 -0700 (Fri, 02 Oct 2020)

Log Message

[JSC] Add Array#item to @@unscopables
https://bugs.webkit.org/show_bug.cgi?id=217243

Reviewed by Yusuke Suzuki.

JSTests:

* stress/unscopables.js:
Update test.

Source/_javascript_Core:

ES2015+ Array methods must be listed in Array.prototype[@@unscopables] per the note here:
https://tc39.es/ecma262/#sec-array.prototype-@@unscopables

The Array#item spec doesn't currently make this explicit, but I created an issue to ensure it isn't overlooked:
https://github.com/tc39/proposal-item-method/issues/30

* runtime/ArrayPrototype.cpp:
(JSC::ArrayPrototype::finishCreation):

LayoutTests:

* js/array-unscopables-properties-expected.txt:
* js/script-tests/array-unscopables-properties.js:
Update test.

Modified Paths

Diff

Modified: trunk/JSTests/ChangeLog (267911 => 267912)


--- trunk/JSTests/ChangeLog	2020-10-03 01:26:13 UTC (rev 267911)
+++ trunk/JSTests/ChangeLog	2020-10-03 01:46:41 UTC (rev 267912)
@@ -1,3 +1,13 @@
+2020-10-02  Ross Kirsling  <[email protected]>
+
+        [JSC] Add Array#item to @@unscopables
+        https://bugs.webkit.org/show_bug.cgi?id=217243
+
+        Reviewed by Yusuke Suzuki.
+
+        * stress/unscopables.js:
+        Update test.
+
 2020-09-30  Ross Kirsling  <[email protected]>
 
         [JSC] Implement item method proposal

Modified: trunk/JSTests/stress/unscopables.js (267911 => 267912)


--- trunk/JSTests/stress/unscopables.js	2020-10-03 01:26:13 UTC (rev 267911)
+++ trunk/JSTests/stress/unscopables.js	2020-10-03 01:46:41 UTC (rev 267912)
@@ -9,7 +9,7 @@
 
     test(typeof unscopables, "object");
     test(unscopables.__proto__, undefined);
-    test(String(Object.keys(unscopables).sort()), "copyWithin,entries,fill,find,findIndex,flat,flatMap,includes,keys,values");
+    test(String(Object.keys(unscopables).sort()), "copyWithin,entries,fill,find,findIndex,flat,flatMap,includes,item,keys,values");
 }());
 
 (function () {

Modified: trunk/LayoutTests/ChangeLog (267911 => 267912)


--- trunk/LayoutTests/ChangeLog	2020-10-03 01:26:13 UTC (rev 267911)
+++ trunk/LayoutTests/ChangeLog	2020-10-03 01:46:41 UTC (rev 267912)
@@ -1,3 +1,14 @@
+2020-10-02  Ross Kirsling  <[email protected]>
+
+        [JSC] Add Array#item to @@unscopables
+        https://bugs.webkit.org/show_bug.cgi?id=217243
+
+        Reviewed by Yusuke Suzuki.
+
+        * js/array-unscopables-properties-expected.txt:
+        * js/script-tests/array-unscopables-properties.js:
+        Update test.
+
 2020-10-02  Chris Dumez  <[email protected]>
 
         Calling suspend() on audio context with no node does not prevent auto transition to running when first node is created

Modified: trunk/LayoutTests/js/array-unscopables-properties-expected.txt (267911 => 267912)


--- trunk/LayoutTests/js/array-unscopables-properties-expected.txt	2020-10-03 01:26:13 UTC (rev 267911)
+++ trunk/LayoutTests/js/array-unscopables-properties-expected.txt	2020-10-03 01:46:41 UTC (rev 267912)
@@ -42,6 +42,10 @@
 PASS Object.getOwnPropertyDescriptor(Array.prototype[Symbol.unscopables], "includes").writable is true
 PASS Object.getOwnPropertyDescriptor(Array.prototype[Symbol.unscopables], "includes").enumerable is true
 PASS Object.getOwnPropertyDescriptor(Array.prototype[Symbol.unscopables], "includes").configurable is true
+PASS Array.prototype[Symbol.unscopables]["item"] is true
+PASS Object.getOwnPropertyDescriptor(Array.prototype[Symbol.unscopables], "item").writable is true
+PASS Object.getOwnPropertyDescriptor(Array.prototype[Symbol.unscopables], "item").enumerable is true
+PASS Object.getOwnPropertyDescriptor(Array.prototype[Symbol.unscopables], "item").configurable is true
 PASS Array.prototype[Symbol.unscopables]["keys"] is true
 PASS Object.getOwnPropertyDescriptor(Array.prototype[Symbol.unscopables], "keys").writable is true
 PASS Object.getOwnPropertyDescriptor(Array.prototype[Symbol.unscopables], "keys").enumerable is true

Modified: trunk/LayoutTests/js/script-tests/array-unscopables-properties.js (267911 => 267912)


--- trunk/LayoutTests/js/script-tests/array-unscopables-properties.js	2020-10-03 01:26:13 UTC (rev 267911)
+++ trunk/LayoutTests/js/script-tests/array-unscopables-properties.js	2020-10-03 01:46:41 UTC (rev 267912)
@@ -15,6 +15,7 @@
     "flat",
     "flatMap",
     "includes",
+    "item",
     "keys",
     "values"
 ];

Modified: trunk/Source/_javascript_Core/ChangeLog (267911 => 267912)


--- trunk/Source/_javascript_Core/ChangeLog	2020-10-03 01:26:13 UTC (rev 267911)
+++ trunk/Source/_javascript_Core/ChangeLog	2020-10-03 01:46:41 UTC (rev 267912)
@@ -1,3 +1,19 @@
+2020-10-02  Ross Kirsling  <[email protected]>
+
+        [JSC] Add Array#item to @@unscopables
+        https://bugs.webkit.org/show_bug.cgi?id=217243
+
+        Reviewed by Yusuke Suzuki.
+
+        ES2015+ Array methods must be listed in Array.prototype[@@unscopables] per the note here:
+        https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
+
+        The Array#item spec doesn't currently make this explicit, but I created an issue to ensure it isn't overlooked:
+        https://github.com/tc39/proposal-item-method/issues/30 
+
+        * runtime/ArrayPrototype.cpp:
+        (JSC::ArrayPrototype::finishCreation):
+
 2020-10-02  Adrian Perez de Castro  <[email protected]>
 
         Unreviewed. [GTK] Add missing locale.h header needed for setlocale()

Modified: trunk/Source/_javascript_Core/runtime/ArrayPrototype.cpp (267911 => 267912)


--- trunk/Source/_javascript_Core/runtime/ArrayPrototype.cpp	2020-10-03 01:26:13 UTC (rev 267911)
+++ trunk/Source/_javascript_Core/runtime/ArrayPrototype.cpp	2020-10-03 01:46:41 UTC (rev 267912)
@@ -129,6 +129,7 @@
         &vm.propertyNames->builtinNames().flatPublicName(),
         &vm.propertyNames->builtinNames().flatMapPublicName(),
         &vm.propertyNames->builtinNames().includesPublicName(),
+        &vm.propertyNames->builtinNames().itemPublicName(),
         &vm.propertyNames->builtinNames().keysPublicName(),
         &vm.propertyNames->builtinNames().valuesPublicName()
     };
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to