summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/Object/keys
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
commit26a029d407be480d791972afb5975cf62c9360a6 (patch)
treef435a8308119effd964b339f76abb83a57c29483 /js/src/tests/test262/built-ins/Object/keys
parentInitial commit. (diff)
downloadfirefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz
firefox-26a029d407be480d791972afb5975cf62c9360a6.zip
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/src/tests/test262/built-ins/Object/keys')
-rw-r--r--js/src/tests/test262/built-ins/Object/keys/15.2.3.14-0-1.js13
-rw-r--r--js/src/tests/test262/built-ins/Object/keys/15.2.3.14-0-2.js11
-rw-r--r--js/src/tests/test262/built-ins/Object/keys/15.2.3.14-1-1.js13
-rw-r--r--js/src/tests/test262/built-ins/Object/keys/15.2.3.14-1-2.js13
-rw-r--r--js/src/tests/test262/built-ins/Object/keys/15.2.3.14-1-3.js13
-rw-r--r--js/src/tests/test262/built-ins/Object/keys/15.2.3.14-1-4.js16
-rw-r--r--js/src/tests/test262/built-ins/Object/keys/15.2.3.14-1-5.js16
-rw-r--r--js/src/tests/test262/built-ins/Object/keys/15.2.3.14-2-1.js18
-rw-r--r--js/src/tests/test262/built-ins/Object/keys/15.2.3.14-2-2.js19
-rw-r--r--js/src/tests/test262/built-ins/Object/keys/15.2.3.14-2-3.js22
-rw-r--r--js/src/tests/test262/built-ins/Object/keys/15.2.3.14-2-4.js18
-rw-r--r--js/src/tests/test262/built-ins/Object/keys/15.2.3.14-2-5.js18
-rw-r--r--js/src/tests/test262/built-ins/Object/keys/15.2.3.14-2-6.js18
-rw-r--r--js/src/tests/test262/built-ins/Object/keys/15.2.3.14-2-7.js31
-rw-r--r--js/src/tests/test262/built-ins/Object/keys/15.2.3.14-2-8.js38
-rw-r--r--js/src/tests/test262/built-ins/Object/keys/15.2.3.14-3-1.js22
-rw-r--r--js/src/tests/test262/built-ins/Object/keys/15.2.3.14-3-2.js19
-rw-r--r--js/src/tests/test262/built-ins/Object/keys/15.2.3.14-3-3.js18
-rw-r--r--js/src/tests/test262/built-ins/Object/keys/15.2.3.14-3-4.js36
-rw-r--r--js/src/tests/test262/built-ins/Object/keys/15.2.3.14-3-5.js20
-rw-r--r--js/src/tests/test262/built-ins/Object/keys/15.2.3.14-3-6.js17
-rw-r--r--js/src/tests/test262/built-ins/Object/keys/15.2.3.14-3-7.js34
-rw-r--r--js/src/tests/test262/built-ins/Object/keys/15.2.3.14-4-1.js33
-rw-r--r--js/src/tests/test262/built-ins/Object/keys/15.2.3.14-5-1.js24
-rw-r--r--js/src/tests/test262/built-ins/Object/keys/15.2.3.14-5-10.js34
-rw-r--r--js/src/tests/test262/built-ins/Object/keys/15.2.3.14-5-11.js23
-rw-r--r--js/src/tests/test262/built-ins/Object/keys/15.2.3.14-5-12.js36
-rw-r--r--js/src/tests/test262/built-ins/Object/keys/15.2.3.14-5-13.js37
-rw-r--r--js/src/tests/test262/built-ins/Object/keys/15.2.3.14-5-14.js34
-rw-r--r--js/src/tests/test262/built-ins/Object/keys/15.2.3.14-5-15.js27
-rw-r--r--js/src/tests/test262/built-ins/Object/keys/15.2.3.14-5-16.js32
-rw-r--r--js/src/tests/test262/built-ins/Object/keys/15.2.3.14-5-2.js26
-rw-r--r--js/src/tests/test262/built-ins/Object/keys/15.2.3.14-5-3.js36
-rw-r--r--js/src/tests/test262/built-ins/Object/keys/15.2.3.14-5-4.js37
-rw-r--r--js/src/tests/test262/built-ins/Object/keys/15.2.3.14-5-5.js29
-rw-r--r--js/src/tests/test262/built-ins/Object/keys/15.2.3.14-5-6.js37
-rw-r--r--js/src/tests/test262/built-ins/Object/keys/15.2.3.14-5-7.js34
-rw-r--r--js/src/tests/test262/built-ins/Object/keys/15.2.3.14-5-8.js34
-rw-r--r--js/src/tests/test262/built-ins/Object/keys/15.2.3.14-5-9.js34
-rw-r--r--js/src/tests/test262/built-ins/Object/keys/15.2.3.14-5-a-1.js22
-rw-r--r--js/src/tests/test262/built-ins/Object/keys/15.2.3.14-5-a-2.js25
-rw-r--r--js/src/tests/test262/built-ins/Object/keys/15.2.3.14-5-a-3.js28
-rw-r--r--js/src/tests/test262/built-ins/Object/keys/15.2.3.14-5-a-4.js24
-rw-r--r--js/src/tests/test262/built-ins/Object/keys/15.2.3.14-5-b-1.js25
-rw-r--r--js/src/tests/test262/built-ins/Object/keys/15.2.3.14-6-1.js26
-rw-r--r--js/src/tests/test262/built-ins/Object/keys/15.2.3.14-6-2.js26
-rw-r--r--js/src/tests/test262/built-ins/Object/keys/15.2.3.14-6-3.js26
-rw-r--r--js/src/tests/test262/built-ins/Object/keys/15.2.3.14-6-4.js30
-rw-r--r--js/src/tests/test262/built-ins/Object/keys/15.2.3.14-6-5.js28
-rw-r--r--js/src/tests/test262/built-ins/Object/keys/browser.js0
-rw-r--r--js/src/tests/test262/built-ins/Object/keys/name.js28
-rw-r--r--js/src/tests/test262/built-ins/Object/keys/not-a-constructor.js31
-rw-r--r--js/src/tests/test262/built-ins/Object/keys/order-after-define-property-with-function.js39
-rw-r--r--js/src/tests/test262/built-ins/Object/keys/order-after-define-property.js44
-rw-r--r--js/src/tests/test262/built-ins/Object/keys/property-traps-order-with-proxied-array.js39
-rw-r--r--js/src/tests/test262/built-ins/Object/keys/proxy-keys.js170
-rw-r--r--js/src/tests/test262/built-ins/Object/keys/proxy-non-enumerable-prop-invariant-1.js56
-rw-r--r--js/src/tests/test262/built-ins/Object/keys/proxy-non-enumerable-prop-invariant-2.js59
-rw-r--r--js/src/tests/test262/built-ins/Object/keys/proxy-non-enumerable-prop-invariant-3.js57
-rw-r--r--js/src/tests/test262/built-ins/Object/keys/return-order.js32
-rw-r--r--js/src/tests/test262/built-ins/Object/keys/shell.js0
61 files changed, 1805 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-0-1.js b/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-0-1.js
new file mode 100644
index 0000000000..1a85693b1c
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-0-1.js
@@ -0,0 +1,13 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 15.2.3.14-0-1
+description: Object.keys must exist as a function
+---*/
+
+var f = Object.keys;
+
+assert.sameValue(typeof(f), "function", 'typeof(f)');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-0-2.js b/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-0-2.js
new file mode 100644
index 0000000000..05ac39ab2e
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-0-2.js
@@ -0,0 +1,11 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 15.2.3.14-0-2
+description: Object.keys must exist as a function taking 1 parameter
+---*/
+
+assert.sameValue(Object.keys.length, 1, 'Object.keys.length');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-1-1.js b/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-1-1.js
new file mode 100644
index 0000000000..42dc96fe11
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-1-1.js
@@ -0,0 +1,13 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 15.2.3.14-1-1
+description: >
+ Object.keys does not throw TypeError if type of first param is not
+ Object
+---*/
+
+Object.keys(0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-1-2.js b/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-1-2.js
new file mode 100644
index 0000000000..2774667e23
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-1-2.js
@@ -0,0 +1,13 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 15.2.3.14-1-2
+description: >
+ Object.keys does not throw TypeError if type of first param is not
+ Object (boolean)
+---*/
+
+Object.keys(true);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-1-3.js b/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-1-3.js
new file mode 100644
index 0000000000..ef3497c04a
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-1-3.js
@@ -0,0 +1,13 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 15.2.3.14-1-3
+description: >
+ Object.keys does not throw TypeError if type of first param is not
+ Object (string)
+---*/
+
+Object.keys('abc');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-1-4.js b/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-1-4.js
new file mode 100644
index 0000000000..5c15c91904
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-1-4.js
@@ -0,0 +1,16 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 15.2.3.14-1-4
+description: >
+ Object.keys throws TypeError if type of first param is not Object
+ (null)
+---*/
+
+
+assert.throws(TypeError, function() {
+ Object.keys(null);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-1-5.js b/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-1-5.js
new file mode 100644
index 0000000000..89b5c9b463
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-1-5.js
@@ -0,0 +1,16 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 15.2.3.14-1-5
+description: >
+ Object.keys throws TypeError if type of first param is not Object
+ (undefined)
+---*/
+
+
+assert.throws(TypeError, function() {
+ Object.keys(undefined);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-2-1.js b/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-2-1.js
new file mode 100644
index 0000000000..aecf57b41f
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-2-1.js
@@ -0,0 +1,18 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 15.2.3.14-2-1
+description: Object.keys returns the standard built-in Array
+---*/
+
+var o = {
+ x: 1,
+ y: 2
+};
+
+var a = Object.keys(o);
+
+assert.sameValue(Array.isArray(a), true, 'Array.isArray(a)');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-2-2.js b/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-2-2.js
new file mode 100644
index 0000000000..8c52be6d93
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-2-2.js
@@ -0,0 +1,19 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 15.2.3.14-2-2
+description: Object.keys returns the standard built-in Array (check [[Class]]
+---*/
+
+var o = {
+ x: 1,
+ y: 2
+};
+
+var a = Object.keys(o);
+var s = Object.prototype.toString.call(a);
+
+assert.sameValue(s, '[object Array]', 's');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-2-3.js b/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-2-3.js
new file mode 100644
index 0000000000..395b3d7789
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-2-3.js
@@ -0,0 +1,22 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 15.2.3.14-2-3
+description: Object.keys returns the standard built-in Array (Array overridden)
+---*/
+
+function Array() {}
+
+var o = {
+ x: 1,
+ y: 2
+};
+
+var a = Object.keys(o);
+
+var s = Object.prototype.toString.call(a);
+
+assert.sameValue(s, '[object Array]', 's');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-2-4.js b/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-2-4.js
new file mode 100644
index 0000000000..65ea90fe28
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-2-4.js
@@ -0,0 +1,18 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 15.2.3.14-2-4
+description: Object.keys returns the standard built-in Array that is extensible
+---*/
+
+var o = {
+ x: 1,
+ y: 2
+};
+
+var a = Object.keys(o);
+
+assert.sameValue(Object.isExtensible(a), true, 'Object.isExtensible(a)');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-2-5.js b/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-2-5.js
new file mode 100644
index 0000000000..5fa5a8aef2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-2-5.js
@@ -0,0 +1,18 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 15.2.3.14-2-5
+description: Object.keys returns the standard built-in Array that is not sealed
+---*/
+
+var o = {
+ x: 1,
+ y: 2
+};
+
+var a = Object.keys(o);
+
+assert.sameValue(Object.isSealed(a), false, 'Object.isSealed(a)');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-2-6.js b/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-2-6.js
new file mode 100644
index 0000000000..7945a71bca
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-2-6.js
@@ -0,0 +1,18 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 15.2.3.14-2-6
+description: Object.keys returns the standard built-in Array that is not frozen
+---*/
+
+var o = {
+ x: 1,
+ y: 2
+};
+
+var a = Object.keys(o);
+
+assert.sameValue(Object.isFrozen(a), false, 'Object.isFrozen(a)');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-2-7.js b/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-2-7.js
new file mode 100644
index 0000000000..21c9f2b24a
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-2-7.js
@@ -0,0 +1,31 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 15.2.3.14-2-7
+description: >
+ Object.keys - 'n' is 0 when 'O' doesn't contain own enumerable
+ data or accessor properties
+---*/
+
+var obj = {};
+
+Object.defineProperty(obj, "prop1", {
+ value: 1001,
+ enumerable: false,
+ configurable: true
+});
+
+Object.defineProperty(obj, "prop2", {
+ get: function() {
+ return 1002;
+ },
+ enumerable: false,
+ configurable: true
+});
+
+var arr = Object.keys(obj);
+
+assert.sameValue(arr.length, 0, 'arr.length');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-2-8.js b/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-2-8.js
new file mode 100644
index 0000000000..b771b257b0
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-2-8.js
@@ -0,0 +1,38 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 15.2.3.14-2-8
+description: >
+ Object.keys - 'n' is the correct value when enumerable properties
+ exist in 'O'
+---*/
+
+var obj = {
+ prop1: 1001,
+ prop2: function() {
+ return 1002;
+ }
+};
+
+Object.defineProperty(obj, "prop3", {
+ value: 1003,
+ enumerable: false,
+ configurable: true
+});
+
+Object.defineProperty(obj, "prop4", {
+ get: function() {
+ return 1004;
+ },
+ enumerable: false,
+ configurable: true
+});
+
+var arr = Object.keys(obj);
+
+assert.sameValue(arr.length, 2, 'arr.length');
+assert.sameValue(arr[0], "prop1", 'arr[0]');
+assert.sameValue(arr[1], "prop2", 'arr[1]');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-3-1.js b/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-3-1.js
new file mode 100644
index 0000000000..0cb6194e33
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-3-1.js
@@ -0,0 +1,22 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 15.2.3.14-3-1
+description: >
+ Object.keys returns the standard built-in Array containing own
+ enumerable properties
+---*/
+
+var o = {
+ x: 1,
+ y: 2
+};
+
+var a = Object.keys(o);
+
+assert.sameValue(a.length, 2, 'a.length');
+assert.sameValue(a[0], 'x', 'a[0]');
+assert.sameValue(a[1], 'y', 'a[1]');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-3-2.js b/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-3-2.js
new file mode 100644
index 0000000000..3e857df3cf
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-3-2.js
@@ -0,0 +1,19 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 15.2.3.14-3-2
+description: >
+ Object.keys returns the standard built-in Array containing own
+ enumerable properties (function)
+---*/
+
+function foo() {}
+foo.x = 1;
+
+var a = Object.keys(foo);
+
+assert.sameValue(a.length, 1, 'a.length');
+assert.sameValue(a[0], 'x', 'a[0]');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-3-3.js b/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-3-3.js
new file mode 100644
index 0000000000..8069aeaba7
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-3-3.js
@@ -0,0 +1,18 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 15.2.3.14-3-3
+description: >
+ Object.keys returns the standard built-in Array containing own
+ enumerable properties (array)
+---*/
+
+var o = [1, 2];
+var a = Object.keys(o);
+
+assert.sameValue(a.length, 2, 'a.length');
+assert.sameValue(a[0], '0', 'a[0]');
+assert.sameValue(a[1], '1', 'a[1]');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-3-4.js b/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-3-4.js
new file mode 100644
index 0000000000..674233c587
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-3-4.js
@@ -0,0 +1,36 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 15.2.3.14-3-4
+description: >
+ Object.keys of an arguments object returns the indices of the
+ given arguments
+---*/
+
+function testArgs2(x, y, z) {
+ // Properties of the arguments object are enumerable.
+ var a = Object.keys(arguments);
+ if (a.length === 2 && a[0] in arguments && a[1] in arguments)
+ return true;
+}
+
+function testArgs3(x, y, z) {
+ // Properties of the arguments object are enumerable.
+ var a = Object.keys(arguments);
+ if (a.length === 3 && a[0] in arguments && a[1] in arguments && a[2] in arguments)
+ return true;
+}
+
+function testArgs4(x, y, z) {
+ // Properties of the arguments object are enumerable.
+ var a = Object.keys(arguments);
+ if (a.length === 4 && a[0] in arguments && a[1] in arguments && a[2] in arguments && a[3] in arguments)
+ return true;
+}
+
+assert(testArgs2(1, 2), 'testArgs2(1, 2) !== true');
+assert(testArgs3(1, 2, 3), 'testArgs3(1, 2, 3) !== true');
+assert(testArgs4(1, 2, 3, 4), 'testArgs4(1, 2, 3, 4) !== true');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-3-5.js b/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-3-5.js
new file mode 100644
index 0000000000..4fa5229dcb
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-3-5.js
@@ -0,0 +1,20 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 15.2.3.14-3-5
+description: Object.keys must return a fresh array on each invocation
+---*/
+
+var literal = {
+ a: 1
+};
+var keysBefore = Object.keys(literal);
+assert.sameValue(keysBefore[0], 'a', 'keysBefore[0]');
+keysBefore[0] = 'x';
+var keysAfter = Object.keys(literal);
+
+assert.sameValue(keysBefore[0], 'x', 'keysBefore[0]');
+assert.sameValue(keysAfter[0], 'a', 'keysAfter[0]');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-3-6.js b/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-3-6.js
new file mode 100644
index 0000000000..9475d9eaa2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-3-6.js
@@ -0,0 +1,17 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 15.2.3.14-3-6
+description: >
+ Object.keys - returns the standard built-in Array (instanceof
+ Array)
+---*/
+
+var obj = {};
+
+var arr = Object.keys(obj);
+
+assert(arr instanceof Array, 'arr instanceof Array !== true');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-3-7.js b/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-3-7.js
new file mode 100644
index 0000000000..2c37cc836f
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-3-7.js
@@ -0,0 +1,34 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 15.2.3.14-3-7
+description: >
+ Object.keys - length of the returned array equals the number of
+ own enumerable properties of 'O'
+---*/
+
+var obj = {
+ prop1: 1001,
+ prop2: 1002
+};
+
+Object.defineProperty(obj, "prop3", {
+ value: 1003,
+ enumerable: true,
+ configurable: true
+});
+
+Object.defineProperty(obj, "prop4", {
+ get: function() {
+ return 1003;
+ },
+ enumerable: false,
+ configurable: true
+});
+
+var arr = Object.keys(obj);
+
+assert.sameValue(arr.length, 3, 'arr.length');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-4-1.js b/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-4-1.js
new file mode 100644
index 0000000000..bda8ef57dc
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-4-1.js
@@ -0,0 +1,33 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 15.2.3.14-4-1
+description: Object.keys - elements of the returned array start from index 0
+---*/
+
+var obj = {
+ prop1: 1001,
+ prop2: 1002
+};
+
+Object.defineProperty(obj, "prop3", {
+ value: 1003,
+ enumerable: true,
+ configurable: true
+});
+
+Object.defineProperty(obj, "prop4", {
+ get: function() {
+ return 1003;
+ },
+ enumerable: true,
+ configurable: true
+});
+
+var arr = Object.keys(obj);
+
+assert(arr.hasOwnProperty(0), 'arr.hasOwnProperty(0) !== true');
+assert.sameValue(arr[0], "prop1", 'arr[0]');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-5-1.js b/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-5-1.js
new file mode 100644
index 0000000000..528b95c1c8
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-5-1.js
@@ -0,0 +1,24 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 15.2.3.14-5-1
+description: >
+ Object.keys - own enumerable data property of 'O' is defined in
+ returned array
+---*/
+
+var obj = {};
+
+Object.defineProperty(obj, "prop", {
+ value: 1003,
+ enumerable: true,
+ configurable: true
+});
+
+var arr = Object.keys(obj);
+
+assert(arr.hasOwnProperty(0), 'arr.hasOwnProperty(0) !== true');
+assert.sameValue(arr[0], "prop", 'arr[0]');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-5-10.js b/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-5-10.js
new file mode 100644
index 0000000000..2abdd3fd39
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-5-10.js
@@ -0,0 +1,34 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 15.2.3.14-5-10
+description: >
+ Object.keys - inherted enumerable accessor property that is
+ over-ridden by non-enumerable own accessor property is not defined
+ in returned array
+---*/
+
+var proto = {};
+Object.defineProperty(proto, "prop", {
+ get: function() {},
+ enumerable: true,
+ configurable: true
+});
+var Con = function() {};
+Con.prototype = proto;
+
+var obj = new Con();
+Object.defineProperty(obj, "prop", {
+ get: function() {},
+ enumerable: false,
+ configurable: true
+});
+
+var arr = Object.keys(obj);
+
+for (var p in arr) {
+ assert.notSameValue(arr[p], "prop", 'arr[p]');
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-5-11.js b/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-5-11.js
new file mode 100644
index 0000000000..e243880fef
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-5-11.js
@@ -0,0 +1,23 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 15.2.3.14-5-11
+description: >
+ Object.keys - own enumerable indexed data property of dense array
+ 'O' is defined in returned array
+---*/
+
+var obj = [1, 2, 3, 4, 5];
+
+var arr = Object.keys(obj);
+
+var initValue = 0;
+for (var p in arr) {
+ if (arr.hasOwnProperty(p)) {
+ assert.sameValue(arr[p], initValue.toString(), 'arr[p]');
+ initValue++;
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-5-12.js b/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-5-12.js
new file mode 100644
index 0000000000..082812b2d1
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-5-12.js
@@ -0,0 +1,36 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 15.2.3.14-5-12
+description: >
+ Object.keys - own enumerable indexed accessor property of dense
+ array 'O' is defined in returned array
+---*/
+
+var propertyFound = false;
+
+var obj = [2, 3, 4, 5];
+
+Object.defineProperty(obj, "prop", {
+ get: function() {
+ return 6;
+ },
+ enumerable: true,
+ configurable: true
+});
+
+var arr = Object.keys(obj);
+
+for (var p in arr) {
+ if (arr.hasOwnProperty(p)) {
+ if (arr[p] === "prop") {
+ propertyFound = true;
+ break;
+ }
+ }
+}
+
+assert(propertyFound, 'Property not found');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-5-13.js b/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-5-13.js
new file mode 100644
index 0000000000..05be7a5c23
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-5-13.js
@@ -0,0 +1,37 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 15.2.3.14-5-13
+description: >
+ Object.keys - own enumerable indexed data property of sparse array
+ 'O' is defined in returned array
+---*/
+
+var obj = [1, , 3, , 5];
+
+Object.defineProperty(obj, 5, {
+ value: 7,
+ enumerable: false,
+ configurable: true
+});
+
+Object.defineProperty(obj, 10000, {
+ value: "ElementWithLargeIndex",
+ enumerable: true,
+ configurable: true
+});
+
+var arr = Object.keys(obj);
+
+var index;
+var initValue = 0;
+for (index = 0; index < 3; index++) {
+ assert.sameValue(arr[index], initValue.toString(), 'Unexpected property at index: ' + index);
+ initValue += 2;
+}
+
+assert.sameValue(arr.length, 4, 'arr.length');
+assert.sameValue(arr[3], "10000", 'arr[3]');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-5-14.js b/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-5-14.js
new file mode 100644
index 0000000000..7bb109925b
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-5-14.js
@@ -0,0 +1,34 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 15.2.3.14-5-14
+description: >
+ Object.keys - own enumerable indexed accessor property of sparse
+ array 'O' is defined in returned array
+---*/
+
+var propertyFound = false;
+
+var obj = [1, , 3, , 5];
+
+Object.defineProperty(obj, "10000", {
+ get: function() {
+ return "ElementWithLargeIndex";
+ },
+ enumerable: true,
+ configurable: true
+});
+
+var arr = Object.keys(obj);
+
+for (var p in arr) {
+ if (arr[p] === "10000") {
+ propertyFound = true;
+ break;
+ }
+}
+
+assert(propertyFound, 'Property not found');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-5-15.js b/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-5-15.js
new file mode 100644
index 0000000000..5f78b94c11
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-5-15.js
@@ -0,0 +1,27 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 15.2.3.14-5-15
+description: >
+ Object.keys - own enumerable indexed data property of String
+ object 'O' is defined in returned array
+---*/
+
+var obj = new String("xyz");
+obj[-20] = -20;
+obj[20] = 20;
+
+Object.defineProperty(obj, "prop", {
+ value: 1003,
+ enumerable: false,
+ configurable: true
+});
+
+var arr = Object.keys(obj);
+
+for (var i = 0; i < arr.length; i++) {
+ assert(obj.hasOwnProperty(arr[i]), 'obj.hasOwnProperty(arr[i]) !== true');
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-5-16.js b/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-5-16.js
new file mode 100644
index 0000000000..8f9e655cfd
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-5-16.js
@@ -0,0 +1,32 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 15.2.3.14-5-16
+description: >
+ Object.keys - own enumerable indexed accessor property of String
+ object 'O' is defined in returned array
+---*/
+
+var obj = new String("xyz");
+obj[-20] = -20;
+obj[20] = 20;
+
+Object.defineProperty(obj, "prop1", {
+ get: function() {},
+ enumerable: true,
+ configurable: true
+});
+Object.defineProperty(obj, "prop2", {
+ get: function() {},
+ enumerable: false,
+ configurable: true
+});
+
+var arr = Object.keys(obj);
+
+for (var i = 0; i < arr.length; i++) {
+ assert(obj.hasOwnProperty(arr[i]), 'obj.hasOwnProperty(arr[i]) !== true');
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-5-2.js b/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-5-2.js
new file mode 100644
index 0000000000..62b39939a1
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-5-2.js
@@ -0,0 +1,26 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 15.2.3.14-5-2
+description: >
+ Object.keys - own enumerable accessor property of 'O' is defined
+ in returned array
+---*/
+
+var obj = {};
+
+Object.defineProperty(obj, "prop", {
+ get: function() {
+ return 1003;
+ },
+ enumerable: true,
+ configurable: true
+});
+
+var arr = Object.keys(obj);
+
+assert(arr.hasOwnProperty(0), 'arr.hasOwnProperty(0) !== true');
+assert.sameValue(arr[0], "prop", 'arr[0]');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-5-3.js b/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-5-3.js
new file mode 100644
index 0000000000..f91f94ec70
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-5-3.js
@@ -0,0 +1,36 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 15.2.3.14-5-3
+description: >
+ Object.keys - non-enumerable own data property of 'O' is not
+ defined in returned array
+---*/
+
+var obj = {
+ prop1: 1001,
+ prop2: 1002
+};
+
+Object.defineProperty(obj, "prop3", {
+ value: 1003,
+ enumerable: true,
+ configurable: true
+});
+
+Object.defineProperty(obj, "prop4", {
+ value: 1004,
+ enumerable: false,
+ configurable: true
+});
+
+var arr = Object.keys(obj);
+
+for (var p in arr) {
+ if (arr.hasOwnProperty(p)) {
+ assert.notSameValue(arr[p], "prop4", 'arr[p]');
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-5-4.js b/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-5-4.js
new file mode 100644
index 0000000000..02ccb887f4
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-5-4.js
@@ -0,0 +1,37 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 15.2.3.14-5-4
+description: >
+ Object.keys - non-enumerable own accessor property of 'O' is not
+ defined in returned array
+---*/
+
+var obj = {};
+
+Object.defineProperty(obj, "prop1", {
+ get: function() {},
+ enumerable: true,
+ configurable: true
+});
+Object.defineProperty(obj, "prop2", {
+ get: function() {},
+ enumerable: false,
+ configurable: true
+});
+Object.defineProperty(obj, "prop3", {
+ get: function() {},
+ enumerable: true,
+ configurable: true
+});
+
+var arr = Object.keys(obj);
+
+for (var p in arr) {
+ if (arr.hasOwnProperty(p)) {
+ assert.notSameValue(arr[p], "prop2", 'arr[p]');
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-5-5.js b/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-5-5.js
new file mode 100644
index 0000000000..579e572b47
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-5-5.js
@@ -0,0 +1,29 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 15.2.3.14-5-5
+description: >
+ Object.keys - inherited enumerable data property of 'O' is not
+ defined in returned array
+---*/
+
+var proto = {};
+Object.defineProperty(proto, "inheritedProp", {
+ value: 1003,
+ enumerable: true,
+ configurable: true
+});
+var Con = function() {};
+Con.prototype = proto;
+
+var obj = new Con();
+obj.prop = 1004;
+
+var arr = Object.keys(obj);
+
+for (var p in arr) {
+ assert.notSameValue(arr[p], "inheritedProp", 'arr[p]');
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-5-6.js b/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-5-6.js
new file mode 100644
index 0000000000..9f10f38dc9
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-5-6.js
@@ -0,0 +1,37 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 15.2.3.14-5-6
+description: >
+ Object.keys - inherited enumerable accessor property of 'O' is not
+ defined in returned array
+---*/
+
+var proto = {};
+Object.defineProperty(proto, "inheritedProp", {
+ get: function() {
+ return 1003;
+ },
+ enumerable: true,
+ configurable: true
+});
+var Con = function() {};
+Con.prototype = proto;
+
+var obj = new Con();
+Object.defineProperty(obj, "prop", {
+ get: function() {
+ return 1004;
+ },
+ enumerable: true,
+ configurable: true
+});
+
+var arr = Object.keys(obj);
+
+for (var p in arr) {
+ assert.notSameValue(arr[p], "inheritedProp", 'arr[p]');
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-5-7.js b/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-5-7.js
new file mode 100644
index 0000000000..df12cdfa17
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-5-7.js
@@ -0,0 +1,34 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 15.2.3.14-5-7
+description: >
+ Object.keys - inherted enumerable data property that is
+ over-ridden by non-enumerable own data property is not defined in
+ returned array
+---*/
+
+var proto = {};
+Object.defineProperty(proto, "prop", {
+ value: 1003,
+ enumerable: true,
+ configurable: true
+});
+var Con = function() {};
+Con.prototype = proto;
+
+var obj = new Con();
+Object.defineProperty(obj, "prop", {
+ value: 1004,
+ enumerable: false,
+ configurable: true
+});
+
+var arr = Object.keys(obj);
+
+for (var p in arr) {
+ assert.notSameValue(arr[p], "prop", 'arr[p]');
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-5-8.js b/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-5-8.js
new file mode 100644
index 0000000000..3be78250f3
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-5-8.js
@@ -0,0 +1,34 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 15.2.3.14-5-8
+description: >
+ Object.keys - inherted enumerable data property that is
+ over-ridden by non-enumerable own accessor property is not defined
+ in returned array
+---*/
+
+var proto = {};
+Object.defineProperty(proto, "prop", {
+ value: 1003,
+ enumerable: true,
+ configurable: true
+});
+var Con = function() {};
+Con.prototype = proto;
+
+var obj = new Con();
+Object.defineProperty(obj, "prop", {
+ get: function() {},
+ enumerable: false,
+ configurable: true
+});
+
+var arr = Object.keys(obj);
+
+for (var p in arr) {
+ assert.notSameValue(arr[p], "prop", 'arr[p]');
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-5-9.js b/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-5-9.js
new file mode 100644
index 0000000000..35558529a7
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-5-9.js
@@ -0,0 +1,34 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 15.2.3.14-5-9
+description: >
+ Object.keys - inherted enumerable accessor property that is
+ over-ridden by non-enumerable own data property is not defined in
+ returned array
+---*/
+
+var proto = {};
+Object.defineProperty(proto, "prop", {
+ get: function() {},
+ enumerable: true,
+ configurable: true
+});
+var Con = function() {};
+Con.prototype = proto;
+
+var obj = new Con();
+Object.defineProperty(obj, "prop", {
+ value: 1003,
+ enumerable: false,
+ configurable: true
+});
+
+var arr = Object.keys(obj);
+
+for (var p in arr) {
+ assert.notSameValue(arr[p], "prop", 'arr[p]');
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-5-a-1.js b/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-5-a-1.js
new file mode 100644
index 0000000000..00063439e5
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-5-a-1.js
@@ -0,0 +1,22 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 15.2.3.14-5-a-1
+description: >
+ Object.keys - 'value' attribute of element in returned array is
+ correct.
+---*/
+
+var obj = {
+ prop1: 1
+};
+
+var array = Object.keys(obj);
+
+var desc = Object.getOwnPropertyDescriptor(array, "0");
+
+assert(desc.hasOwnProperty("value"), 'desc.hasOwnProperty("value") !== true');
+assert.sameValue(desc.value, "prop1", 'desc.value');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-5-a-2.js b/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-5-a-2.js
new file mode 100644
index 0000000000..e662ab89a7
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-5-a-2.js
@@ -0,0 +1,25 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 15.2.3.14-5-a-2
+description: >
+ Object.keys - 'writable' attribute of element of returned array is
+ correct
+---*/
+
+var obj = {
+ prop1: 100
+};
+
+var array = Object.keys(obj);
+
+array[0] = "isWritable";
+
+var desc = Object.getOwnPropertyDescriptor(array, "0");
+
+assert.sameValue(array[0], "isWritable", 'array[0]');
+assert(desc.hasOwnProperty("writable"), 'desc.hasOwnProperty("writable") !== true');
+assert.sameValue(desc.writable, true, 'desc.writable');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-5-a-3.js b/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-5-a-3.js
new file mode 100644
index 0000000000..afd5c28f4a
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-5-a-3.js
@@ -0,0 +1,28 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 15.2.3.14-5-a-3
+description: >
+ Object.keys - 'enumerable' attribute of element of returned array
+ is correct
+---*/
+
+var obj = {
+ prop1: 100
+};
+
+var array = Object.keys(obj);
+var desc = Object.getOwnPropertyDescriptor(array, "0");
+var result = false;
+for (var index in array) {
+ if (obj.hasOwnProperty(array[index]) && array[index] === "prop1") {
+ result = true;
+ }
+}
+
+assert(result, 'result !== true');
+assert(desc.hasOwnProperty("enumerable"), 'desc.hasOwnProperty("enumerable") !== true');
+assert.sameValue(desc.enumerable, true, 'desc.enumerable');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-5-a-4.js b/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-5-a-4.js
new file mode 100644
index 0000000000..08e6e4618f
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-5-a-4.js
@@ -0,0 +1,24 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 15.2.3.14-5-a-4
+description: >
+ Object.keys - Verify that 'configurable' attribute of element of
+ returned array is correct
+---*/
+
+var obj = {
+ prop1: 100
+};
+
+var array = Object.keys(obj);
+var desc = Object.getOwnPropertyDescriptor(array, "0");
+
+delete array[0];
+
+assert.sameValue(typeof array[0], "undefined", 'typeof array[0]');
+assert(desc.hasOwnProperty("configurable"), 'desc.hasOwnProperty("configurable") !== true');
+assert.sameValue(desc.configurable, true, 'desc.configurable');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-5-b-1.js b/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-5-b-1.js
new file mode 100644
index 0000000000..840621073d
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-5-b-1.js
@@ -0,0 +1,25 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 15.2.3.14-5-b-1
+description: Object.keys - Verify that 'index' of returned array is ascend by 1
+---*/
+
+var obj = {
+ prop1: 100,
+ prop2: 200,
+ prop3: 300
+};
+
+var array = Object.keys(obj);
+
+var idx = 0;
+for (var index in array) {
+ if (array.hasOwnProperty(index)) {
+ assert.sameValue(index, idx.toString(), 'index');
+ idx++;
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-6-1.js b/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-6-1.js
new file mode 100644
index 0000000000..fd815ad331
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-6-1.js
@@ -0,0 +1,26 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 15.2.3.14-6-1
+description: >
+ Object.keys - the order of elements in returned array is the same
+ with the order of properties in 'O' (dense array)
+---*/
+
+var denseArray = [1, 2, 3];
+
+var tempArray = [];
+for (var p in denseArray) {
+ if (denseArray.hasOwnProperty(p)) {
+ tempArray.push(p);
+ }
+}
+
+var returnedArray = Object.keys(denseArray);
+
+for (var index in returnedArray) {
+ assert.sameValue(tempArray[index], returnedArray[index], 'tempArray[index]');
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-6-2.js b/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-6-2.js
new file mode 100644
index 0000000000..e493fc1496
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-6-2.js
@@ -0,0 +1,26 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 15.2.3.14-6-2
+description: >
+ Object.keys - the order of elements in returned array is the same
+ with the order of properties in 'O' (sparse array)
+---*/
+
+var sparseArray = [1, 2, , 4, , 6];
+
+var tempArray = [];
+for (var p in sparseArray) {
+ if (sparseArray.hasOwnProperty(p)) {
+ tempArray.push(p);
+ }
+}
+
+var returnedArray = Object.keys(sparseArray);
+
+for (var index in returnedArray) {
+ assert.sameValue(tempArray[index], returnedArray[index], 'tempArray[index]');
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-6-3.js b/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-6-3.js
new file mode 100644
index 0000000000..6edec3cb8c
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-6-3.js
@@ -0,0 +1,26 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 15.2.3.14-6-3
+description: >
+ Object.keys - the order of elements in returned array is the same
+ with the order of properties in 'O' (String object)
+---*/
+
+var str = new String("abc");
+
+var tempArray = [];
+for (var p in str) {
+ if (str.hasOwnProperty(p)) {
+ tempArray.push(p);
+ }
+}
+
+var returnedArray = Object.keys(str);
+
+for (var index in returnedArray) {
+ assert.sameValue(tempArray[index], returnedArray[index], 'tempArray[index]');
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-6-4.js b/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-6-4.js
new file mode 100644
index 0000000000..9889e713a8
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-6-4.js
@@ -0,0 +1,30 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 15.2.3.14-6-4
+description: >
+ Object.keys - the order of elements in returned array is the same
+ with the order of properties in 'O' (Arguments object)
+---*/
+
+var func = function(a, b, c) {
+ return arguments;
+};
+
+var args = func(1, "b", false);
+
+var tempArray = [];
+for (var p in args) {
+ if (args.hasOwnProperty(p)) {
+ tempArray.push(p);
+ }
+}
+
+var returnedArray = Object.keys(args);
+
+for (var index in returnedArray) {
+ assert.sameValue(tempArray[index], returnedArray[index], 'tempArray[index]');
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-6-5.js b/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-6-5.js
new file mode 100644
index 0000000000..079ead456b
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Object/keys/15.2.3.14-6-5.js
@@ -0,0 +1,28 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 15.2.3.14-6-5
+description: >
+ Object.keys - the order of elements in returned array is the same
+ with the order of properties in 'O' (any other built-in object)
+---*/
+
+var obj = new Date();
+obj.prop1 = 100;
+obj.prop2 = "prop2";
+
+var tempArray = [];
+for (var p in obj) {
+ if (obj.hasOwnProperty(p)) {
+ tempArray.push(p);
+ }
+}
+
+var returnedArray = Object.keys(obj);
+
+for (var index in returnedArray) {
+ assert.sameValue(tempArray[index], returnedArray[index], 'tempArray[index]');
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Object/keys/browser.js b/js/src/tests/test262/built-ins/Object/keys/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Object/keys/browser.js
diff --git a/js/src/tests/test262/built-ins/Object/keys/name.js b/js/src/tests/test262/built-ins/Object/keys/name.js
new file mode 100644
index 0000000000..4839cf4031
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Object/keys/name.js
@@ -0,0 +1,28 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es6id: 19.1.2.14
+description: >
+ Object.keys.name is "keys".
+info: |
+ Object.keys ( O )
+
+ 17 ECMAScript Standard Built-in Objects:
+ Every built-in Function object, including constructors, that is not
+ identified as an anonymous function has a name property whose value
+ is a String.
+
+ Unless otherwise specified, the name property of a built-in Function
+ object, if it exists, has the attributes { [[Writable]]: false,
+ [[Enumerable]]: false, [[Configurable]]: true }.
+includes: [propertyHelper.js]
+---*/
+
+assert.sameValue(Object.keys.name, "keys");
+
+verifyNotEnumerable(Object.keys, "name");
+verifyNotWritable(Object.keys, "name");
+verifyConfigurable(Object.keys, "name");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Object/keys/not-a-constructor.js b/js/src/tests/test262/built-ins/Object/keys/not-a-constructor.js
new file mode 100644
index 0000000000..dc5c3083f2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Object/keys/not-a-constructor.js
@@ -0,0 +1,31 @@
+// Copyright (C) 2020 Rick Waldron. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-ecmascript-standard-built-in-objects
+description: >
+ Object.keys does not implement [[Construct]], is not new-able
+info: |
+ ECMAScript Function Objects
+
+ Built-in function objects that are not identified as constructors do not
+ implement the [[Construct]] internal method unless otherwise specified in
+ the description of a particular function.
+
+ sec-evaluatenew
+
+ ...
+ 7. If IsConstructor(constructor) is false, throw a TypeError exception.
+ ...
+includes: [isConstructor.js]
+features: [Reflect.construct, arrow-function]
+---*/
+
+assert.sameValue(isConstructor(Object.keys), false, 'isConstructor(Object.keys) must return false');
+
+assert.throws(TypeError, () => {
+ new Object.keys({});
+}, '`new Object.keys({})` throws TypeError');
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Object/keys/order-after-define-property-with-function.js b/js/src/tests/test262/built-ins/Object/keys/order-after-define-property-with-function.js
new file mode 100644
index 0000000000..cd7a3ed392
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Object/keys/order-after-define-property-with-function.js
@@ -0,0 +1,39 @@
+// Copyright (C) 2020 Alexey Shvayka. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-object.keys
+description: >
+ Property names are returned in ascending chronological order of creation
+ that is unaffected by [[DefineOwnProperty]].
+info: |
+ Object.keys ( O )
+
+ [...]
+ 2. Let nameList be ? EnumerableOwnPropertyNames(obj, key).
+ 3. Return CreateArrayFromList(nameList).
+
+ EnumerableOwnPropertyNames ( O, kind )
+
+ [...]
+ 2. Let ownKeys be ? O.[[OwnPropertyKeys]]().
+ [...]
+
+ OrdinaryOwnPropertyKeys ( O )
+
+ [...]
+ 3. For each own property key P of O that is a String but is not an array index,
+ in ascending chronological order of property creation, do
+ a. Add P as the last element of keys.
+ [...]
+ 5. Return keys.
+features: [arrow-function]
+includes: [compareArray.js]
+---*/
+
+var fn = () => {};
+fn.a = 1;
+Object.defineProperty(fn, "length", {enumerable: true});
+assert.compareArray(Object.keys(fn), ["length", "a"]);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Object/keys/order-after-define-property.js b/js/src/tests/test262/built-ins/Object/keys/order-after-define-property.js
new file mode 100644
index 0000000000..151dd83a56
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Object/keys/order-after-define-property.js
@@ -0,0 +1,44 @@
+// Copyright (C) 2020 Alexey Shvayka. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-object.keys
+description: >
+ Property names are returned in ascending chronological order of creation
+ that is unaffected by [[DefineOwnProperty]].
+info: |
+ Object.keys ( O )
+
+ [...]
+ 2. Let nameList be ? EnumerableOwnPropertyNames(obj, key).
+ 3. Return CreateArrayFromList(nameList).
+
+ EnumerableOwnPropertyNames ( O, kind )
+
+ [...]
+ 2. Let ownKeys be ? O.[[OwnPropertyKeys]]().
+ [...]
+
+ OrdinaryOwnPropertyKeys ( O )
+
+ [...]
+ 3. For each own property key P of O that is a String but is not an array index,
+ in ascending chronological order of property creation, do
+ a. Add P as the last element of keys.
+ [...]
+ 5. Return keys.
+includes: [compareArray.js]
+---*/
+
+var obj = {};
+Object.defineProperty(obj, "a", {
+ get: function() {},
+ set: function(_value) {},
+ enumerable: true,
+ configurable: true,
+});
+obj.b = 2;
+Object.defineProperty(obj, "a", {value: 1});
+assert.compareArray(Object.keys(obj), ["a", "b"]);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Object/keys/property-traps-order-with-proxied-array.js b/js/src/tests/test262/built-ins/Object/keys/property-traps-order-with-proxied-array.js
new file mode 100644
index 0000000000..44cbbb5ed8
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Object/keys/property-traps-order-with-proxied-array.js
@@ -0,0 +1,39 @@
+// Copyright (C) 2018 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-object.keys
+description: >
+ Ensure the correct property traps are called on a proxy of an array.
+info: |
+ 19.1.2.16 Object.keys ( O )
+ ...
+ 2. Let nameList be ? EnumerableOwnPropertyNames(obj, "key").
+ ...
+
+ 7.3.21 EnumerableOwnPropertyNames ( O, kind )
+ ...
+ 2. Let ownKeys be ? O.[[OwnPropertyKeys]]().
+ ...
+ 4. For each element key of ownKeys in List order, do
+ a. If Type(key) is String, then
+ i. Let desc be ? O.[[GetOwnProperty]](key).
+ ...
+features: [Proxy]
+includes: [compareArray.js]
+---*/
+
+var log = [];
+
+Object.keys(new Proxy([], new Proxy({},{
+ get(t, pk, r) {
+ log.push(pk);
+ }
+})));
+
+assert.compareArray([
+ "ownKeys",
+ "getOwnPropertyDescriptor",
+], log);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Object/keys/proxy-keys.js b/js/src/tests/test262/built-ins/Object/keys/proxy-keys.js
new file mode 100644
index 0000000000..5ed94aa1e2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Object/keys/proxy-keys.js
@@ -0,0 +1,170 @@
+// Copyright (C) 2017 Caitlin Potter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-object.keys
+description: >
+ Object.keys() observably performs [[GetOwnProperty]]
+info: |
+ 19.1.2.16 Object.keys ( O )
+
+ 1. Let obj be ? ToObject(O).
+ 2. Let nameList be ? EnumerableOwnProperties(obj, "key").
+ ...
+
+ 7.3.21 EnumerableOwnProperties ( O, kind )
+
+ 1. Assert: Type(O) is Object.
+ 2. Let ownKeys be ? O.[[OwnPropertyKeys]]().
+ 3. Let properties be a new empty List.
+ 4. For each element key of ownKeys in List order, do
+ a. If Type(key) is String, then
+ i. Let desc be ? O.[[GetOwnProperty]](key).
+ ...
+features: [Symbol]
+---*/
+
+let log = [];
+let s = Symbol("test");
+let target = {
+ x: true
+};
+
+let ownKeys = {
+ get length() {
+ log.push({
+ name: "get ownKeys['length']",
+ receiver: this
+ });
+ return 3;
+ },
+
+ get 0() {
+ log.push({
+ name: "get ownKeys[0]",
+ receiver: this
+ });
+ return "a";
+ },
+
+ get 1() {
+ log.push({
+ name: "get ownKeys[1]",
+ receiver: this
+ });
+ return s;
+ },
+
+ get 2() {
+ log.push({
+ name: "get ownKeys[2]",
+ receiver: this
+ });
+ return "b";
+ }
+};
+
+let ownKeysDescriptors = {
+ "a": {
+ enumerable: true,
+ configurable: true,
+ value: 1
+ },
+
+ "b": {
+ enumerable: false,
+ configurable: true,
+ value: 2
+ },
+
+ [s]: {
+ enumerable: true,
+ configurable: true,
+ value: 3
+ }
+};
+
+let handler = {
+ get ownKeys() {
+ log.push({
+ name: "get handler.ownKeys",
+ receiver: this
+ });
+ return (...args) => {
+ log.push({
+ name: "call handler.ownKeys",
+ receiver: this,
+ args
+ });
+ return ownKeys;
+ };
+ },
+
+ get getOwnPropertyDescriptor() {
+ log.push({
+ name: "get handler.getOwnPropertyDescriptor",
+ receiver: this
+ });
+ return (...args) => {
+ log.push({
+ name: "call handler.getOwnPropertyDescriptor",
+ receiver: this,
+ args
+ });
+ const name = args[1];
+ return ownKeysDescriptors[name];
+ };
+ }
+};
+
+let proxy = new Proxy(target, handler);
+let keys = Object.keys(proxy);
+
+assert.sameValue(log.length, 10);
+
+assert.sameValue(log[0].name, "get handler.ownKeys");
+assert.sameValue(log[0].receiver, handler);
+
+assert.sameValue(log[1].name, "call handler.ownKeys");
+assert.sameValue(log[1].receiver, handler);
+assert.sameValue(log[1].args.length, 1);
+assert.sameValue(log[1].args[0], target);
+
+// CreateListFromArrayLike(trapResultArray, « String, Symbol »).
+assert.sameValue(log[2].name, "get ownKeys['length']");
+assert.sameValue(log[2].receiver, ownKeys);
+
+assert.sameValue(log[3].name, "get ownKeys[0]");
+assert.sameValue(log[3].receiver, ownKeys);
+
+assert.sameValue(log[4].name, "get ownKeys[1]");
+assert.sameValue(log[4].receiver, ownKeys);
+
+assert.sameValue(log[5].name, "get ownKeys[2]");
+assert.sameValue(log[5].receiver, ownKeys);
+
+// Let desc be ? O.[[GetOwnProperty]]("a").
+assert.sameValue(log[6].name, "get handler.getOwnPropertyDescriptor");
+assert.sameValue(log[6].receiver, handler);
+
+assert.sameValue(log[7].name, "call handler.getOwnPropertyDescriptor");
+assert.sameValue(log[7].receiver, handler);
+assert.sameValue(log[7].args.length, 2);
+assert.sameValue(log[7].args[0], target);
+assert.sameValue(log[7].args[1], "a");
+
+// Let desc be ? O.[[GetOwnProperty]]("b").
+assert.sameValue(log[8].name, "get handler.getOwnPropertyDescriptor");
+assert.sameValue(log[8].receiver, handler);
+
+assert.sameValue(log[9].name, "call handler.getOwnPropertyDescriptor");
+assert.sameValue(log[9].receiver, handler);
+assert.sameValue(log[9].args.length, 2);
+assert.sameValue(log[9].args[0], target);
+assert.sameValue(log[9].args[1], "b");
+
+// "a" is the only enumerable String-keyed property.
+assert.sameValue(keys.length, 1);
+assert.sameValue(keys[0], "a");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Object/keys/proxy-non-enumerable-prop-invariant-1.js b/js/src/tests/test262/built-ins/Object/keys/proxy-non-enumerable-prop-invariant-1.js
new file mode 100644
index 0000000000..39c2e4294f
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Object/keys/proxy-non-enumerable-prop-invariant-1.js
@@ -0,0 +1,56 @@
+// Copyright (C) 2019 Alexey Shvayka. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-object.keys
+description: >
+ Proxy [[OwnPropertyKeys]] trap does not skip non-enumerable keys when validating invariant:
+ * The result List must contain the keys of all non-configurable own properties of
+ the target object.
+info: |
+ Object.keys ( O )
+
+ ...
+ 2. Let nameList be ? EnumerableOwnPropertyNames(obj, "key").
+
+ EnumerableOwnPropertyNames ( O, kind )
+
+ ...
+ 2. Let ownKeys be ? O.[[OwnPropertyKeys]]().
+
+ [[OwnPropertyKeys]] ( )
+
+ ...
+ 11. Let targetKeys be ? target.[[OwnPropertyKeys]]().
+ ...
+ 15. Let targetNonconfigurableKeys be a new empty List.
+ 16. For each element key of targetKeys, do
+ a. Let desc be ? target.[[GetOwnProperty]](key).
+ b. If desc is not undefined and desc.[[Configurable]] is false, then
+ i. Append key as an element of targetNonconfigurableKeys.
+ ...
+ 18. Let uncheckedResultKeys be a new List which is a copy of trapResult.
+ 19. For each key that is an element of targetNonconfigurableKeys, do
+ a. If key is not an element of uncheckedResultKeys, throw a TypeError exception.
+features: [Proxy]
+---*/
+
+var target = {};
+Object.defineProperty(target, 'prop', {
+ value: 1,
+ writable: true,
+ enumerable: false,
+ configurable: false,
+});
+
+var proxy = new Proxy(target, {
+ ownKeys: function() {
+ return [];
+ },
+});
+
+assert.throws(TypeError, function() {
+ Object.keys(proxy);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Object/keys/proxy-non-enumerable-prop-invariant-2.js b/js/src/tests/test262/built-ins/Object/keys/proxy-non-enumerable-prop-invariant-2.js
new file mode 100644
index 0000000000..846a48d03b
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Object/keys/proxy-non-enumerable-prop-invariant-2.js
@@ -0,0 +1,59 @@
+// Copyright (C) 2019 Alexey Shvayka. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-object.keys
+description: >
+ Proxy [[OwnPropertyKeys]] trap does not skip non-enumerable keys when validating invariant:
+ * If the target object is not extensible, then the result List must contain all the keys of
+ the own properties of the target object and no other values.
+info: |
+ Object.keys ( O )
+
+ ...
+ 2. Let nameList be ? EnumerableOwnPropertyNames(obj, "key").
+
+ EnumerableOwnPropertyNames ( O, kind )
+
+ ...
+ 2. Let ownKeys be ? O.[[OwnPropertyKeys]]().
+
+ [[OwnPropertyKeys]] ( )
+
+ ...
+ 11. Let targetKeys be ? target.[[OwnPropertyKeys]]().
+ 16. For each element key of targetKeys, do
+ a. Let desc be ? target.[[GetOwnProperty]](key).
+ b. If desc is not undefined and desc.[[Configurable]] is false, then
+ ...
+ c. Else,
+ i. Append key as an element of targetConfigurableKeys.
+ ...
+ 18. Let uncheckedResultKeys be a new List which is a copy of trapResult.
+ ...
+ 21. For each key that is an element of targetConfigurableKeys, do
+ a. If key is not an element of uncheckedResultKeys, throw a TypeError exception.
+features: [Proxy]
+---*/
+
+var target = {};
+Object.defineProperty(target, 'prop', {
+ value: 2,
+ writable: true,
+ enumerable: false,
+ configurable: true,
+});
+
+var proxy = new Proxy(target, {
+ ownKeys: function() {
+ return [];
+ },
+});
+
+Object.preventExtensions(target);
+
+assert.throws(TypeError, function() {
+ Object.keys(proxy);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Object/keys/proxy-non-enumerable-prop-invariant-3.js b/js/src/tests/test262/built-ins/Object/keys/proxy-non-enumerable-prop-invariant-3.js
new file mode 100644
index 0000000000..d1d73af448
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Object/keys/proxy-non-enumerable-prop-invariant-3.js
@@ -0,0 +1,57 @@
+// Copyright (C) 2019 Alexey Shvayka. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-object.keys
+description: >
+ Proxy [[OwnPropertyKeys]] trap does not skip non-enumerable keys when validating invariant:
+ * If the target object is not extensible, then the result List must contain all the keys of
+ the own properties of the target object and no other values.
+info: |
+ Object.keys ( O )
+
+ ...
+ 2. Let nameList be ? EnumerableOwnPropertyNames(obj, "key").
+
+ EnumerableOwnPropertyNames ( O, kind )
+
+ ...
+ 2. Let ownKeys be ? O.[[OwnPropertyKeys]]().
+
+ [[OwnPropertyKeys]] ( )
+
+ ...
+ 11. Let targetKeys be ? target.[[OwnPropertyKeys]]().
+ 16. For each element key of targetKeys, do
+ a. Let desc be ? target.[[GetOwnProperty]](key).
+ b. If desc is not undefined and desc.[[Configurable]] is false, then
+ ...
+ c. Else,
+ i. Append key as an element of targetConfigurableKeys.
+ ...
+ 18. Let uncheckedResultKeys be a new List which is a copy of trapResult.
+ ...
+ 22. If uncheckedResultKeys is not empty, throw a TypeError exception.
+features: [Proxy]
+---*/
+
+var target = {};
+Object.defineProperty(target, 'prop', {
+ value: 3,
+ writable: true,
+ enumerable: false,
+ configurable: true,
+});
+
+var proxy = new Proxy(target, {
+ ownKeys: function() {
+ return ['prop'];
+ },
+});
+
+Object.preventExtensions(target);
+
+var keys = Object.keys(proxy);
+assert.sameValue(keys.length, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Object/keys/return-order.js b/js/src/tests/test262/built-ins/Object/keys/return-order.js
new file mode 100644
index 0000000000..fcc909c4d7
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Object/keys/return-order.js
@@ -0,0 +1,32 @@
+// Copyright 2019 Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-object.keys
+description: Object.keys enumeration order
+features: [for-in-order]
+includes: [compareArray.js]
+---*/
+
+var o = {
+ p1: 'p1',
+ p2: 'p2',
+ p3: 'p3',
+};
+o.p4 = 'p4';
+
+o[2] = '2';
+o[0] = '0';
+o[1] = '1';
+
+delete o.p1;
+delete o.p3;
+o.p1 = 'p1';
+
+var actual = Object.keys(o);
+
+var expected = ['0', '1', '2', 'p2', 'p4', 'p1'];
+
+assert.compareArray(actual, expected);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Object/keys/shell.js b/js/src/tests/test262/built-ins/Object/keys/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Object/keys/shell.js