Add Array.prototype.{flat,flatMap} to unscopables
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 24 Jun 2019 22:29:00 +0000 (22:29 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 24 Jun 2019 22:29:00 +0000 (22:29 +0000)
https://bugs.webkit.org/show_bug.cgi?id=194322

Patch by Alexey Shvayka <shvaikalesh@gmail.com> on 2019-06-24
Reviewed by Keith Miller.

JSTests:

* stress/unscopables.js: Fix test.
* test262/expectations.yaml: Mark 2 test cases as passing.

Source/JavaScriptCore:

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

LayoutTests:

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

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@246765 268f45cc-cd09-0410-ab3c-d52691b4dbfc

JSTests/ChangeLog
JSTests/stress/unscopables.js
JSTests/test262/expectations.yaml
LayoutTests/ChangeLog
LayoutTests/js/array-unscopables-properties-expected.txt
LayoutTests/js/script-tests/array-unscopables-properties.js
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/runtime/ArrayPrototype.cpp

index 1e5eee5..6bdd69a 100644 (file)
@@ -1,3 +1,13 @@
+2019-06-24  Alexey Shvayka  <shvaikalesh@gmail.com>
+
+        Add Array.prototype.{flat,flatMap} to unscopables
+        https://bugs.webkit.org/show_bug.cgi?id=194322
+
+        Reviewed by Keith Miller.
+
+        * stress/unscopables.js: Fix test.
+        * test262/expectations.yaml: Mark 2 test cases as passing.
+
 2019-06-21  Mark Lam  <mark.lam@apple.com>
 
         ArraySlice needs to keep the source array alive.
index a6efd36..f7d916f 100644 (file)
@@ -9,7 +9,7 @@ function test(actual, expected) {
 
     test(typeof unscopables, "object");
     test(unscopables.__proto__, undefined);
-    test(String(Object.keys(unscopables).sort()), "copyWithin,entries,fill,find,findIndex,includes,keys,values");
+    test(String(Object.keys(unscopables).sort()), "copyWithin,entries,fill,find,findIndex,flat,flatMap,includes,keys,values");
 }());
 
 (function () {
index 006d01c..b692b11 100644 (file)
@@ -624,9 +624,6 @@ test/built-ins/Array/of/return-abrupt-from-data-property.js:
 test/built-ins/Array/proto-from-ctor-realm.js:
   default: 'Test262Error: Expected SameValue(«», Â«Â») to be true'
   strict mode: 'Test262Error: Expected SameValue(«», Â«Â») to be true'
-test/built-ins/Array/prototype/Symbol.unscopables/value.js:
-  default: 'Test262Error: `flat` property value Expected SameValue(«undefined», Â«true») to be true'
-  strict mode: 'Test262Error: `flat` property value Expected SameValue(«undefined», Â«true») to be true'
 test/built-ins/Array/prototype/filter/target-array-with-non-writable-property.js:
   default: 'TypeError: Attempted to assign to readonly property.'
   strict mode: 'TypeError: Attempted to assign to readonly property.'
index 480a9e8..bbeccf1 100644 (file)
@@ -1,3 +1,13 @@
+2019-06-24  Alexey Shvayka  <shvaikalesh@gmail.com>
+
+        Add Array.prototype.{flat,flatMap} to unscopables
+        https://bugs.webkit.org/show_bug.cgi?id=194322
+
+        Reviewed by Keith Miller.
+
+        * js/array-unscopables-properties-expected.txt:
+        * js/script-tests/array-unscopables-properties.js:
+
 2019-06-24  Jer Noble  <jer.noble@apple.com>
 
         iOS 12.2 Drawing portrait video to canvas is sideways
index ad217e9..ffa6bb1 100644 (file)
@@ -30,6 +30,14 @@ PASS Array.prototype[Symbol.unscopables]["findIndex"] is true
 PASS Object.getOwnPropertyDescriptor(Array.prototype[Symbol.unscopables], "findIndex").writable is true
 PASS Object.getOwnPropertyDescriptor(Array.prototype[Symbol.unscopables], "findIndex").enumerable is true
 PASS Object.getOwnPropertyDescriptor(Array.prototype[Symbol.unscopables], "findIndex").configurable is true
+PASS Array.prototype[Symbol.unscopables]["flat"] is true
+PASS Object.getOwnPropertyDescriptor(Array.prototype[Symbol.unscopables], "flat").writable is true
+PASS Object.getOwnPropertyDescriptor(Array.prototype[Symbol.unscopables], "flat").enumerable is true
+PASS Object.getOwnPropertyDescriptor(Array.prototype[Symbol.unscopables], "flat").configurable is true
+PASS Array.prototype[Symbol.unscopables]["flatMap"] is true
+PASS Object.getOwnPropertyDescriptor(Array.prototype[Symbol.unscopables], "flatMap").writable is true
+PASS Object.getOwnPropertyDescriptor(Array.prototype[Symbol.unscopables], "flatMap").enumerable is true
+PASS Object.getOwnPropertyDescriptor(Array.prototype[Symbol.unscopables], "flatMap").configurable is true
 PASS Array.prototype[Symbol.unscopables]["includes"] is true
 PASS Object.getOwnPropertyDescriptor(Array.prototype[Symbol.unscopables], "includes").writable is true
 PASS Object.getOwnPropertyDescriptor(Array.prototype[Symbol.unscopables], "includes").enumerable is true
index d200210..ea60b38 100644 (file)
@@ -12,6 +12,8 @@ let expectedEntries = [
     "fill",
     "find",
     "findIndex",
+    "flat",
+    "flatMap",
     "includes",
     "keys",
     "values"
index 74bd2ff..6ea4c24 100644 (file)
@@ -1,3 +1,13 @@
+2019-06-24  Alexey Shvayka  <shvaikalesh@gmail.com>
+
+        Add Array.prototype.{flat,flatMap} to unscopables
+        https://bugs.webkit.org/show_bug.cgi?id=194322
+
+        Reviewed by Keith Miller.
+
+        * runtime/ArrayPrototype.cpp:
+        (JSC::ArrayPrototype::finishCreation):
+
 2019-06-24  Mark Lam  <mark.lam@apple.com>
 
         ArraySlice needs to keep the source array alive.
index b9a4e75..16f59a2 100644 (file)
@@ -132,6 +132,8 @@ void ArrayPrototype::finishCreation(VM& vm, JSGlobalObject* globalObject)
         &vm.propertyNames->builtinNames().fillPublicName(),
         &vm.propertyNames->builtinNames().findPublicName(),
         &vm.propertyNames->builtinNames().findIndexPublicName(),
+        &vm.propertyNames->builtinNames().flatPublicName(),
+        &vm.propertyNames->builtinNames().flatMapPublicName(),
         &vm.propertyNames->builtinNames().includesPublicName(),
         &vm.propertyNames->builtinNames().keysPublicName(),
         &vm.propertyNames->builtinNames().valuesPublicName()