Title: [268528] trunk
Revision
268528
Author
[email protected]
Date
2020-10-15 10:23:02 -0700 (Thu, 15 Oct 2020)

Log Message

REGRESSION (r268489): test/built-ins/Object/entries/order-after-define-property.js failing on test262 bots
https://bugs.webkit.org/show_bug.cgi?id=217738

Reviewed by Yusuke Suzuki.

JSTests:

* stress/object-entries.js:

Source/_javascript_Core:

This change fixes an oversight of r268489 that caused Object.entries to
return a sparse array if its argument contained non-enumerable properties.

* builtins/ObjectConstructor.js:
(entries):

Modified Paths

Diff

Modified: trunk/JSTests/ChangeLog (268527 => 268528)


--- trunk/JSTests/ChangeLog	2020-10-15 17:01:09 UTC (rev 268527)
+++ trunk/JSTests/ChangeLog	2020-10-15 17:23:02 UTC (rev 268528)
@@ -1,3 +1,12 @@
+2020-10-15  Alexey Shvayka  <[email protected]>
+
+        REGRESSION (r268489): test/built-ins/Object/entries/order-after-define-property.js failing on test262 bots
+        https://bugs.webkit.org/show_bug.cgi?id=217738
+
+        Reviewed by Yusuke Suzuki.
+
+        * stress/object-entries.js:
+
 2020-10-14  Ross Kirsling  <[email protected]>
 
         Update test262 (2020.10.14)

Modified: trunk/JSTests/stress/object-entries.js (268527 => 268528)


--- trunk/JSTests/stress/object-entries.js	2020-10-15 17:01:09 UTC (rev 268527)
+++ trunk/JSTests/stress/object-entries.js	2020-10-15 17:23:02 UTC (rev 268528)
@@ -113,11 +113,28 @@
 if (!passed)
     throw new Error("Object.entries should get property descriptor.");
 
-Array.prototype.push = function () { throw new Error("Array.prototype.push should not be used during invoking of Object.entries.")};
-Object.getOwnPropertyDescriptor = function () { throw new Error("Array.prototype.getOwnPropertyDescriptor should not be used during invoking of Object.entries.")};
+const withDontEnum = Object.create(null, {
+    a: {value: 1, enumerable: false},
+    b: {value: 2, enumerable: true},
+    c: {value: 3, enumerable: false},
+    d: {value: 4, enumerable: true},
+});
 
+entries = Object.entries(withDontEnum);
+passed = compare(entries, [['b', 2], ['d', 4]]);
+
+if (!passed)
+    throw new Error("Object.entries returned wrong result (non-enumerable properties).");
+
+delete Array.prototype.push;
+delete Object.prototype.propertyIsEnumerable;
+delete Object.getOwnPropertyDescriptor;
+delete Object.getOwnPropertyNames;
+delete Reflect.getOwnPropertyDescriptor;
+delete Reflect.ownKeys;
+
 entries = Object.entries({a:'1-2', b:'3-4'});
-passed = Array.isArray(entries) && String(entries[0]) === "a,1-2" && String(entries[1]) === "b,3-4";
+passed = compare(entries, [['a', '1-2'], ['b', '3-4']]);
 
 if (!passed)
-    throw new Error("Object.entries return wrong result.");
+    throw new Error("Object.entries returned wrong result (deleted built-ins).");

Modified: trunk/Source/_javascript_Core/ChangeLog (268527 => 268528)


--- trunk/Source/_javascript_Core/ChangeLog	2020-10-15 17:01:09 UTC (rev 268527)
+++ trunk/Source/_javascript_Core/ChangeLog	2020-10-15 17:23:02 UTC (rev 268528)
@@ -1,3 +1,16 @@
+2020-10-15  Alexey Shvayka  <[email protected]>
+
+        REGRESSION (r268489): test/built-ins/Object/entries/order-after-define-property.js failing on test262 bots
+        https://bugs.webkit.org/show_bug.cgi?id=217738
+
+        Reviewed by Yusuke Suzuki.
+
+        This change fixes an oversight of r268489 that caused Object.entries to
+        return a sparse array if its argument contained non-enumerable properties.
+
+        * builtins/ObjectConstructor.js:
+        (entries):
+
 2020-10-14  Alexey Shvayka  <[email protected]>
 
         Use @putByValDirect instead of Array.prototype.@push in built-ins

Modified: trunk/Source/_javascript_Core/builtins/ObjectConstructor.js (268527 => 268528)


--- trunk/Source/_javascript_Core/builtins/ObjectConstructor.js	2020-10-15 17:01:09 UTC (rev 268527)
+++ trunk/Source/_javascript_Core/builtins/ObjectConstructor.js	2020-10-15 17:23:02 UTC (rev 268528)
@@ -35,7 +35,7 @@
     for (var i = 0, length = names.length; i < length; ++i) {
         var name = names[i];
         if (@propertyIsEnumerable(obj, name))
-            @putByValDirect(properties, i, [name, obj[name]]);
+            @arrayPush(properties, [name, obj[name]]);
     }
 
     return properties;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to