test262: test262/test/built-ins/Object/getOwnPropertyNames/15.2.3.4-4-44.js
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 16 Apr 2017 17:37:43 +0000 (17:37 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 16 Apr 2017 17:37:43 +0000 (17:37 +0000)
https://bugs.webkit.org/show_bug.cgi?id=170879

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2017-04-16
Reviewed by Saam Barati.

JSTests:

* ChakraCore/test/es5/enumerable.baseline-jsc:
* test262.yaml:

Source/JavaScriptCore:

* runtime/StringObject.h:
* runtime/StringObject.cpp:
(JSC::StringObject::getOwnPropertyNames):
(JSC::StringObject::getOwnNonIndexPropertyNames):
Ensure 'length' comes after all indexed properties by moving
it out to the getOwnNonIndexPropertyNames method which is called
inside of getOwnPropertyNames after JSObject handles indices.

LayoutTests:

* js/Object-getOwnPropertyNames-expected.txt:
* js/script-tests/Object-getOwnPropertyNames.js:

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

JSTests/ChakraCore/test/es5/enumerable.baseline-jsc
JSTests/ChangeLog
JSTests/test262.yaml
LayoutTests/ChangeLog
LayoutTests/js/Object-getOwnPropertyNames-expected.txt
LayoutTests/js/script-tests/Object-getOwnPropertyNames.js
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/runtime/StringObject.cpp
Source/JavaScriptCore/runtime/StringObject.h

index 13aef69..377e288 100644 (file)
@@ -169,9 +169,9 @@ TypeError : Attempting to change access mechanism for an unconfigurable property
   1: b enumerable
   2: c enumerable
   3: d enumerable
-  length: 4
   6: 6 enumerable configurable writable
   7: 7 enumerable
+  length: 4
   --- Enumerate ---
   0: a
   1: b
index e4da9b2..5b3cb5d 100644 (file)
@@ -1,5 +1,15 @@
 2017-04-16  Joseph Pecoraro  <pecoraro@apple.com>
 
+        test262: test262/test/built-ins/Object/getOwnPropertyNames/15.2.3.4-4-44.js
+        https://bugs.webkit.org/show_bug.cgi?id=170879
+
+        Reviewed by Saam Barati.
+
+        * ChakraCore/test/es5/enumerable.baseline-jsc:
+        * test262.yaml:
+
+2017-04-16  Joseph Pecoraro  <pecoraro@apple.com>
+
         test262: test262/test/built-ins/Date/prototype/Symbol.toPrimitive/name.js
         https://bugs.webkit.org/show_bug.cgi?id=170884
 
index 411bbe6..07f5b6e 100644 (file)
 - path: test262/test/built-ins/Object/getOwnPropertyNames/15.2.3.4-4-43.js
   cmd: runTest262 :normal, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js"], [:strict]
 - path: test262/test/built-ins/Object/getOwnPropertyNames/15.2.3.4-4-44.js
-  cmd: runTest262 :fail, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js", "../../../../harness/compareArray.js"], []
+  cmd: runTest262 :normal, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js", "../../../../harness/compareArray.js"], []
 - path: test262/test/built-ins/Object/getOwnPropertyNames/15.2.3.4-4-44.js
-  cmd: runTest262 :fail, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js", "../../../../harness/compareArray.js"], [:strict]
+  cmd: runTest262 :normal, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js", "../../../../harness/compareArray.js"], [:strict]
 - path: test262/test/built-ins/Object/getOwnPropertyNames/15.2.3.4-4-45.js
   cmd: runTest262 :normal, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js"], []
 - path: test262/test/built-ins/Object/getOwnPropertyNames/15.2.3.4-4-45.js
index 14bf603..3474ded 100644 (file)
@@ -1,3 +1,13 @@
+2017-04-16  Joseph Pecoraro  <pecoraro@apple.com>
+
+        test262: test262/test/built-ins/Object/getOwnPropertyNames/15.2.3.4-4-44.js
+        https://bugs.webkit.org/show_bug.cgi?id=170879
+
+        Reviewed by Saam Barati.
+
+        * js/Object-getOwnPropertyNames-expected.txt:
+        * js/script-tests/Object-getOwnPropertyNames.js:
+
 2017-04-14  Nikita Vasilyev  <nvasilyev@apple.com>
 
         Web Inspector: WebSockets: messages with non-latin letters are displayed incorrectly
index 91e8dae..38230ce 100644 (file)
@@ -17,6 +17,7 @@ PASS getSortedOwnPropertyNames(new String('')) is ['length']
 PASS getSortedOwnPropertyNames(new String('a')) is ['0', 'length']
 PASS getSortedOwnPropertyNames(new String('abc')) is ['0', '1', '2', 'length']
 PASS getSortedOwnPropertyNames((function(){var x=new String('');x.__proto__=[1,2,3];return x;})()) is ['length']
+PASS getSortedOwnPropertyNames((function(){var x=new String('abc');x.bar='baz';x[999]='d';return x;})()) is ['0', '1', '2', '999', 'bar', 'length']
 PASS getSortedOwnPropertyNames([]) is ['length']
 PASS getSortedOwnPropertyNames([null]) is ['0', 'length']
 PASS getSortedOwnPropertyNames([null,null]) is ['0','1', 'length']
index 386438d..1d8e893 100644 (file)
@@ -19,6 +19,7 @@ var expectedPropertyNamesSet = {
     "new String('a')": "['0', 'length']",
     "new String('abc')": "['0', '1', '2', 'length']",
     "(function(){var x=new String('');x.__proto__=[1,2,3];return x;})()": "['length']",
+    "(function(){var x=new String('abc');x.bar='baz';x[999]='d';return x;})()": "['0', '1', '2', '999', 'bar', 'length']",
 // Array objects
     "[]": "['length']",
     "[null]": "['0', 'length']",
index 1ce3a26..f7224de 100644 (file)
@@ -1,5 +1,20 @@
 2017-04-16  Joseph Pecoraro  <pecoraro@apple.com>
 
+        test262: test262/test/built-ins/Object/getOwnPropertyNames/15.2.3.4-4-44.js
+        https://bugs.webkit.org/show_bug.cgi?id=170879
+
+        Reviewed by Saam Barati.
+
+        * runtime/StringObject.h:
+        * runtime/StringObject.cpp:
+        (JSC::StringObject::getOwnPropertyNames):
+        (JSC::StringObject::getOwnNonIndexPropertyNames):
+        Ensure 'length' comes after all indexed properties by moving
+        it out to the getOwnNonIndexPropertyNames method which is called
+        inside of getOwnPropertyNames after JSObject handles indices.
+
+2017-04-16  Joseph Pecoraro  <pecoraro@apple.com>
+
         test262: test262/test/built-ins/Date/prototype/Symbol.toPrimitive/name.js
         https://bugs.webkit.org/show_bug.cgi?id=170884
 
index 19bc332..5e77ed6 100644 (file)
@@ -157,9 +157,15 @@ void StringObject::getOwnPropertyNames(JSObject* object, ExecState* exec, Proper
         for (int i = 0; i < size; ++i)
             propertyNames.add(Identifier::from(exec, i));
     }
+    return JSObject::getOwnPropertyNames(thisObject, exec, propertyNames, mode);
+}
+
+void StringObject::getOwnNonIndexPropertyNames(JSObject* object, ExecState* exec, PropertyNameArray& propertyNames, EnumerationMode mode)
+{
+    StringObject* thisObject = jsCast<StringObject*>(object);
     if (mode.includeDontEnumProperties())
         propertyNames.add(exec->propertyNames().length);
-    return JSObject::getOwnPropertyNames(thisObject, exec, propertyNames, mode);
+    return JSObject::getOwnNonIndexPropertyNames(thisObject, exec, propertyNames, mode);
 }
 
 StringObject* constructString(VM& vm, JSGlobalObject* globalObject, JSValue string)
index 60cb61f..24fff00 100644 (file)
@@ -54,6 +54,7 @@ public:
     JS_EXPORT_PRIVATE static bool deleteProperty(JSCell*, ExecState*, PropertyName);
     JS_EXPORT_PRIVATE static bool deletePropertyByIndex(JSCell*, ExecState*, unsigned propertyName);
     JS_EXPORT_PRIVATE static void getOwnPropertyNames(JSObject*, ExecState*, PropertyNameArray&, EnumerationMode);
+    JS_EXPORT_PRIVATE static void getOwnNonIndexPropertyNames(JSObject*, ExecState*, PropertyNameArray&, EnumerationMode);
     JS_EXPORT_PRIVATE static bool defineOwnProperty(JSObject*, ExecState*, PropertyName, const PropertyDescriptor&, bool shouldThrow);
 
     DECLARE_EXPORT_INFO;