summaryrefslogtreecommitdiffstats
path: root/js/src/tests/ecma_5/Object
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /js/src/tests/ecma_5/Object
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'js/src/tests/ecma_5/Object')
-rw-r--r--js/src/tests/ecma_5/Object/15.2.3.12.js46
-rw-r--r--js/src/tests/ecma_5/Object/15.2.3.14-01.js92
-rw-r--r--js/src/tests/ecma_5/Object/15.2.3.3-01.js285
-rw-r--r--js/src/tests/ecma_5/Object/15.2.3.4-01.js30
-rw-r--r--js/src/tests/ecma_5/Object/15.2.3.4-02.js52
-rw-r--r--js/src/tests/ecma_5/Object/15.2.3.4-03.js55
-rw-r--r--js/src/tests/ecma_5/Object/15.2.3.4-04.js31
-rw-r--r--js/src/tests/ecma_5/Object/15.2.3.5-01.js60
-rw-r--r--js/src/tests/ecma_5/Object/15.2.3.6-define-over-method.js24
-rw-r--r--js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-01-of-32.js6
-rw-r--r--js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-02-of-32.js6
-rw-r--r--js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-03-of-32.js6
-rw-r--r--js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-04-of-32.js6
-rw-r--r--js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-05-of-32.js6
-rw-r--r--js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-06-of-32.js6
-rw-r--r--js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-07-of-32.js6
-rw-r--r--js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-08-of-32.js6
-rw-r--r--js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-09-of-32.js6
-rw-r--r--js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-10-of-32.js6
-rw-r--r--js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-11-of-32.js6
-rw-r--r--js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-12-of-32.js6
-rw-r--r--js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-13-of-32.js6
-rw-r--r--js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-14-of-32.js6
-rw-r--r--js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-15-of-32.js6
-rw-r--r--js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-16-of-32.js6
-rw-r--r--js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-17-of-32.js6
-rw-r--r--js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-18-of-32.js6
-rw-r--r--js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-19-of-32.js6
-rw-r--r--js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-20-of-32.js6
-rw-r--r--js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-21-of-32.js6
-rw-r--r--js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-22-of-32.js6
-rw-r--r--js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-23-of-32.js6
-rw-r--r--js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-24-of-32.js6
-rw-r--r--js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-25-of-32.js6
-rw-r--r--js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-26-of-32.js6
-rw-r--r--js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-27-of-32.js6
-rw-r--r--js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-28-of-32.js6
-rw-r--r--js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-29-of-32.js6
-rw-r--r--js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-30-of-32.js6
-rw-r--r--js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-31-of-32.js6
-rw-r--r--js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-32-of-32.js6
-rw-r--r--js/src/tests/ecma_5/Object/15.2.3.6-function-length.js35
-rw-r--r--js/src/tests/ecma_5/Object/15.2.3.6-middle-redefinition-1-of-8.js6
-rw-r--r--js/src/tests/ecma_5/Object/15.2.3.6-middle-redefinition-2-of-8.js6
-rw-r--r--js/src/tests/ecma_5/Object/15.2.3.6-middle-redefinition-3-of-8.js6
-rw-r--r--js/src/tests/ecma_5/Object/15.2.3.6-middle-redefinition-4-of-8.js6
-rw-r--r--js/src/tests/ecma_5/Object/15.2.3.6-middle-redefinition-5-of-8.js6
-rw-r--r--js/src/tests/ecma_5/Object/15.2.3.6-middle-redefinition-6-of-8.js6
-rw-r--r--js/src/tests/ecma_5/Object/15.2.3.6-middle-redefinition-7-of-8.js6
-rw-r--r--js/src/tests/ecma_5/Object/15.2.3.6-middle-redefinition-8-of-8.js6
-rw-r--r--js/src/tests/ecma_5/Object/15.2.3.6-miscellaneous.js74
-rw-r--r--js/src/tests/ecma_5/Object/15.2.3.6-new-definition.js35
-rw-r--r--js/src/tests/ecma_5/Object/15.2.3.6-redefinition-1-of-4.js39
-rw-r--r--js/src/tests/ecma_5/Object/15.2.3.6-redefinition-2-of-4.js39
-rw-r--r--js/src/tests/ecma_5/Object/15.2.3.6-redefinition-3-of-4.js39
-rw-r--r--js/src/tests/ecma_5/Object/15.2.3.6-redefinition-4-of-4.js39
-rw-r--r--js/src/tests/ecma_5/Object/15.2.3.7-01.js137
-rw-r--r--js/src/tests/ecma_5/Object/15.2.3.9.js51
-rw-r--r--js/src/tests/ecma_5/Object/add-property-non-extensible.js118
-rw-r--r--js/src/tests/ecma_5/Object/browser.js0
-rw-r--r--js/src/tests/ecma_5/Object/clear-dictionary-accessor-getset.js55
-rw-r--r--js/src/tests/ecma_5/Object/defineProperties-callable-accessor.js19
-rw-r--r--js/src/tests/ecma_5/Object/defineProperty-setup.js1071
-rw-r--r--js/src/tests/ecma_5/Object/extensibility-01.js103
-rw-r--r--js/src/tests/ecma_5/Object/extensibility-02.js42
-rw-r--r--js/src/tests/ecma_5/Object/freeze-global-eval-const.js13
-rw-r--r--js/src/tests/ecma_5/Object/gOPD-vs-prototype-accessor.js15
-rw-r--r--js/src/tests/ecma_5/Object/getPrototypeOf-array.js32
-rw-r--r--js/src/tests/ecma_5/Object/isPrototypeOf.js86
-rw-r--r--js/src/tests/ecma_5/Object/mutation-prevention-methods.js124
-rw-r--r--js/src/tests/ecma_5/Object/object-create-with-primitive-second-arg.js8
-rw-r--r--js/src/tests/ecma_5/Object/object-toString-01.js46
-rw-r--r--js/src/tests/ecma_5/Object/preventExtensions-idempotent.js30
-rw-r--r--js/src/tests/ecma_5/Object/propertyIsEnumerable.js199
-rw-r--r--js/src/tests/ecma_5/Object/proto-property-change-writability-set.js56
-rw-r--r--js/src/tests/ecma_5/Object/shell.js0
-rw-r--r--js/src/tests/ecma_5/Object/toLocaleString.js102
-rw-r--r--js/src/tests/ecma_5/Object/vacuous-accessor-unqualified-name.js26
78 files changed, 3548 insertions, 0 deletions
diff --git a/js/src/tests/ecma_5/Object/15.2.3.12.js b/js/src/tests/ecma_5/Object/15.2.3.12.js
new file mode 100644
index 000000000..00593a240
--- /dev/null
+++ b/js/src/tests/ecma_5/Object/15.2.3.12.js
@@ -0,0 +1,46 @@
+/*
+ * Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/licenses/publicdomain/
+ */
+
+/* Object.isFrozen */
+
+assertEq(Object.isFrozen({}), false);
+
+assertEq(Object.isFrozen(Object.preventExtensions({})), true);
+
+var o = Object.defineProperty({}, 'x', { writable:true, configurable:true });
+Object.preventExtensions(o);
+assertEq(Object.isFrozen(o), false);
+
+var o = Object.defineProperty({}, 'x', { writable:false, configurable:true });
+Object.preventExtensions(o);
+assertEq(Object.isFrozen(o), false);
+
+var o = Object.defineProperty({}, 'x', { writable:true, configurable:false });
+Object.preventExtensions(o);
+assertEq(Object.isFrozen(o), false);
+
+var o = Object.defineProperty({}, 'x', { writable:false, configurable:false });
+assertEq(Object.isFrozen(o), false);
+
+var o = Object.defineProperty({}, 'x', { writable:false, configurable:false });
+Object.preventExtensions(o);
+assertEq(Object.isFrozen(o), true);
+
+var o = Object.defineProperties({}, { x: { writable:true, configurable:true },
+ y: { writable:false, configurable:false } });
+Object.preventExtensions(o);
+assertEq(Object.isFrozen(o), false);
+
+var o = Object.defineProperties({}, { x: { writable:false, configurable:false },
+ y: { writable:true, configurable:true } });
+Object.preventExtensions(o);
+assertEq(Object.isFrozen(o), false);
+
+var o = Object.defineProperties({}, { x: { writable:true, configurable:true },
+ y: { writable:true, configurable:true } });
+Object.preventExtensions(o);
+assertEq(Object.isFrozen(o), false);
+
+reportCompare(true, true);
diff --git a/js/src/tests/ecma_5/Object/15.2.3.14-01.js b/js/src/tests/ecma_5/Object/15.2.3.14-01.js
new file mode 100644
index 000000000..81ab3fe38
--- /dev/null
+++ b/js/src/tests/ecma_5/Object/15.2.3.14-01.js
@@ -0,0 +1,92 @@
+/*
+ * Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/licenses/publicdomain/
+ */
+
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 307791;
+var summary = 'ES5 Object.keys(O)';
+var actual = '';
+var expect = '';
+
+printBugNumber(BUGNUMBER);
+printStatus(summary);
+
+function arraysEqual(a1, a2)
+{
+ return a1.length === a2.length &&
+ a1.every(function(v, i) { return v === a2[i]; });
+}
+
+/**************
+ * BEGIN TEST *
+ **************/
+
+assertEq(Object.keys.length, 1);
+
+var o, keys;
+
+o = { a: 3, b: 2 };
+keys = Object.keys(o);
+assertEq(arraysEqual(keys, ["a", "b"]), true,
+ "" + keys);
+
+o = { get a() { return 17; }, b: 2 };
+keys = Object.keys(o),
+assertEq(arraysEqual(keys, ["a", "b"]), true,
+ "" + keys);
+
+o = { __iterator__: function() { return Iterator({a: 2, b: 3}); } };
+keys = Object.keys(o);
+assertEq(arraysEqual(keys, ["__iterator__"]), true,
+ "" + keys);
+
+o = { a: 1, b: 2 };
+delete o.a;
+o.a = 3;
+keys = Object.keys(o);
+assertEq(arraysEqual(keys, ["b", "a"]), true,
+ "" + keys);
+
+o = [0, 1, 2];
+keys = Object.keys(o);
+assertEq(arraysEqual(keys, ["0", "1", "2"]), true,
+ "" + keys);
+
+o = /./.exec("abc");
+keys = Object.keys(o);
+assertEq(arraysEqual(keys, ["0", "index", "input"]), true,
+ "" + keys);
+
+o = { a: 1, b: 2, c: 3 };
+delete o.b;
+o.b = 5;
+keys = Object.keys(o);
+assertEq(arraysEqual(keys, ["a", "c", "b"]), true,
+ "" + keys);
+
+function f() { }
+f.prototype.p = 1;
+o = new f();
+o.g = 1;
+keys = Object.keys(o);
+assertEq(arraysEqual(keys, ["g"]), true,
+ "" + keys);
+
+if (typeof Namespace !== "undefined" && typeof QName !== "undefined")
+{
+ var o2 = {};
+ var qn = new QName(new Namespace("foo"), "v");
+ o2.f = 1;
+ o2[qn] = 3;
+ o2.baz = 4;
+ var keys2 = Object.keys(o2);
+ assertEq(arraysEqual(keys2, ["f", "foo::v", "baz"]), true,
+ "" + keys2);
+}
+
+/******************************************************************************/
+
+reportCompare(expect, actual, "Object.keys");
+
+printStatus("All tests passed!");
diff --git a/js/src/tests/ecma_5/Object/15.2.3.3-01.js b/js/src/tests/ecma_5/Object/15.2.3.3-01.js
new file mode 100644
index 000000000..ed94a14f4
--- /dev/null
+++ b/js/src/tests/ecma_5/Object/15.2.3.3-01.js
@@ -0,0 +1,285 @@
+/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 505587;
+var summary = 'ES5 Object.getOwnPropertyDescriptor(O)';
+var actual = '';
+var expect = '';
+
+printBugNumber(BUGNUMBER);
+printStatus (summary);
+
+/**************
+ * BEGIN TEST *
+ **************/
+
+function assertEq(a, e, msg)
+{
+ function SameValue(v1, v2)
+ {
+ if (v1 === 0 && v2 === 0)
+ return 1 / v1 === 1 / v2;
+ if (v1 !== v1 && v2 !== v2)
+ return true;
+ return v1 === v2;
+ }
+
+ if (!SameValue(a, e))
+ {
+ var stack = new Error().stack || "";
+ throw "Assertion failed: got " + a + ", expected " + e +
+ (msg ? ": " + msg : "") +
+ (stack ? "\nStack:\n" + stack : "");
+ }
+}
+
+function expectDescriptor(actual, expected)
+{
+ if (actual === undefined && expected === undefined)
+ return;
+
+ assertEq(typeof actual, "object");
+ assertEq(typeof expected, "object");
+
+ var fields =
+ {
+ value: true,
+ get: true,
+ set: true,
+ enumerable: true,
+ writable: true,
+ configurable: true
+ };
+ for (var p in fields)
+ assertEq(actual.hasOwnProperty(p), expected.hasOwnProperty(p), p);
+ for (var p in actual)
+ assertEq(p in fields, true, p);
+ for (var p in expected)
+ assertEq(p in fields, true, p);
+
+ assertEq(actual.hasOwnProperty("value"), actual.hasOwnProperty("writable"));
+ assertEq(actual.hasOwnProperty("get"), actual.hasOwnProperty("set"));
+ if (actual.hasOwnProperty("value"))
+ {
+ assertEq(actual.value, expected.value);
+ assertEq(actual.writable, expected.writable);
+ }
+ else
+ {
+ assertEq(actual.get, expected.get);
+ assertEq(actual.set, expected.set);
+ }
+
+ assertEq(actual.hasOwnProperty("enumerable"), true);
+ assertEq(actual.hasOwnProperty("configurable"), true);
+ assertEq(actual.enumerable, expected.enumerable);
+ assertEq(actual.configurable, expected.configurable);
+}
+
+function adjustDescriptorField(o, actual, expect, field)
+{
+ assertEq(field === "get" || field === "set", true);
+ var lookup = "__lookup" + (field === "get" ? "G" : "S") + "etter";
+ if (typeof o[lookup] === "function")
+ expect[field] = o[lookup](field);
+ else
+ actual[field] = expect[field] = undefined; /* censor if we can't lookup */
+}
+
+/******************************************************************************/
+
+var o, pd, expected;
+
+o = { get x() { return 12; } };
+
+pd = Object.getOwnPropertyDescriptor(o, "x");
+expected =
+ {
+ set: undefined,
+ enumerable: true,
+ configurable: true
+ };
+adjustDescriptorField(o, pd, expected, "get");
+
+expectDescriptor(pd, expected);
+
+/******************************************************************************/
+
+var o2;
+
+o = Object.create(Object.prototype, { x: {get: function () { return 12; } } });
+
+pd = Object.getOwnPropertyDescriptor(o, "x");
+expected =
+ {
+ set: undefined,
+ enumerable: false,
+ configurable: false
+ };
+adjustDescriptorField(o, pd, expected, "get");
+
+expectDescriptor(pd, expected);
+
+o2 = Object.create(o);
+assertEq(Object.getOwnPropertyDescriptor(o2, "x"), undefined);
+
+/******************************************************************************/
+
+o = {};
+o.b = 12;
+
+pd = Object.getOwnPropertyDescriptor(o, "b");
+expected =
+ {
+ value: 12,
+ writable: true,
+ enumerable: true,
+ configurable: true
+ };
+expectDescriptor(pd, expected);
+
+/******************************************************************************/
+
+o = { get y() { return 17; }, set y(z) { } };
+
+pd = Object.getOwnPropertyDescriptor(o, "y");
+expected =
+ {
+ enumerable: true,
+ configurable: true
+ };
+adjustDescriptorField(o, pd, expected, "get");
+adjustDescriptorField(o, pd, expected, "set");
+
+expectDescriptor(pd, expected);
+
+/******************************************************************************/
+
+o = {};
+
+pd = Object.getOwnPropertyDescriptor(o, "absent");
+
+expectDescriptor(pd, undefined);
+
+/******************************************************************************/
+
+pd = Object.getOwnPropertyDescriptor([], "length");
+expected =
+ {
+ value: 0,
+ writable: true,
+ enumerable: false,
+ configurable: false
+ };
+
+expectDescriptor(pd, expected);
+
+pd = Object.getOwnPropertyDescriptor([1], "length");
+expected =
+ {
+ value: 1,
+ writable: true,
+ enumerable: false,
+ configurable: false
+ };
+
+expectDescriptor(pd, expected);
+
+pd = Object.getOwnPropertyDescriptor([1,], "length");
+expected =
+ {
+ value: 1,
+ writable: true,
+ enumerable: false,
+ configurable: false
+ };
+
+expectDescriptor(pd, expected);
+
+pd = Object.getOwnPropertyDescriptor([1,,], "length");
+expected =
+ {
+ value: 2,
+ writable: true,
+ enumerable: false,
+ configurable: false
+ };
+
+expectDescriptor(pd, expected);
+
+/******************************************************************************/
+
+pd = Object.getOwnPropertyDescriptor(new String("foobar"), "length");
+expected =
+ {
+ value: 6,
+ writable: false,
+ enumerable: false,
+ configurable: false
+ };
+
+expectDescriptor(pd, expected);
+
+/******************************************************************************/
+
+function foo() { }
+o = foo;
+
+pd = Object.getOwnPropertyDescriptor(o, "length");
+expected =
+ {
+ value: 0,
+ writable: false,
+ enumerable: false,
+ configurable: true
+ };
+
+expectDescriptor(pd, expected);
+
+pd = Object.getOwnPropertyDescriptor(o, "prototype");
+expected =
+ {
+ value: foo.prototype,
+ writable: true,
+ enumerable: false,
+ configurable: false
+ };
+
+expectDescriptor(pd, expected);
+
+/******************************************************************************/
+
+pd = Object.getOwnPropertyDescriptor(Function, "length");
+expected =
+ {
+ value: 1,
+ writable: false,
+ enumerable: false,
+ configurable: true
+ };
+
+expectDescriptor(pd, expected);
+
+/******************************************************************************/
+
+o = /foo/im;
+
+pd = Object.getOwnPropertyDescriptor(o, "lastIndex");
+expected =
+ {
+ value: 0,
+ writable: true,
+ enumerable: false,
+ configurable: false
+ };
+
+expectDescriptor(pd, expected);
+
+/******************************************************************************/
+
+reportCompare(expect, actual, "Object.getOwnPropertyDescriptor");
+
+printStatus("All tests passed");
diff --git a/js/src/tests/ecma_5/Object/15.2.3.4-01.js b/js/src/tests/ecma_5/Object/15.2.3.4-01.js
new file mode 100644
index 000000000..3a84f0b66
--- /dev/null
+++ b/js/src/tests/ecma_5/Object/15.2.3.4-01.js
@@ -0,0 +1,30 @@
+/*
+ * Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/licenses/publicdomain/
+ * Contributor:
+ * Jeff Walden <jwalden+code@mit.edu>
+ */
+
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 518663;
+var summary =
+ 'Object.getOwnPropertyNames should play nicely with enumerator caching';
+
+print(BUGNUMBER + ": " + summary);
+
+/**************
+ * BEGIN TEST *
+ **************/
+
+for (var p in JSON);
+var names = Object.getOwnPropertyNames(JSON);
+assertEq(names.length >= 2, true,
+ "wrong number of property names? [" + names + "]");
+assertEq(names.indexOf("parse") >= 0, true);
+assertEq(names.indexOf("stringify") >= 0, true);
+
+/******************************************************************************/
+
+reportCompare(true, true);
+
+print("All tests passed!");
diff --git a/js/src/tests/ecma_5/Object/15.2.3.4-02.js b/js/src/tests/ecma_5/Object/15.2.3.4-02.js
new file mode 100644
index 000000000..b5e0842c2
--- /dev/null
+++ b/js/src/tests/ecma_5/Object/15.2.3.4-02.js
@@ -0,0 +1,52 @@
+/*
+ * Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/licenses/publicdomain/
+ * Contributor:
+ * Jeff Walden <jwalden+code@mit.edu>
+ */
+
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 518663;
+var summary = 'Object.getOwnPropertyNames: array objects';
+
+print(BUGNUMBER + ": " + summary);
+
+/**************
+ * BEGIN TEST *
+ **************/
+
+var a, names, expected;
+
+function arraysEqual(a1, a2)
+{
+ return a1.length === a2.length &&
+ a1.every(function(v, i) { return v === a2[i]; });
+}
+
+
+a = [0, 1, 2];
+
+names = Object.getOwnPropertyNames(a).sort();
+expected = ["0", "1", "2", "length"].sort();
+
+a = [1, , , 7];
+a.p = 2;
+Object.defineProperty(a, "q", { value: 42, enumerable: false });
+
+names = Object.getOwnPropertyNames(a).sort();
+expected = ["0", "3", "p", "q", "length"].sort();
+assertEq(arraysEqual(names, expected), true);
+
+
+a = [];
+
+names = Object.getOwnPropertyNames(a).sort();
+expected = ["length"];
+assertEq(arraysEqual(names, expected), true);
+
+
+/******************************************************************************/
+
+reportCompare(true, true);
+
+print("All tests passed!");
diff --git a/js/src/tests/ecma_5/Object/15.2.3.4-03.js b/js/src/tests/ecma_5/Object/15.2.3.4-03.js
new file mode 100644
index 000000000..55dcc139c
--- /dev/null
+++ b/js/src/tests/ecma_5/Object/15.2.3.4-03.js
@@ -0,0 +1,55 @@
+/*
+ * Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/licenses/publicdomain/
+ * Contributor:
+ * Jeff Walden <jwalden+code@mit.edu>
+ */
+
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 518663;
+var summary = 'Object.getOwnPropertyNames: function objects';
+
+print(BUGNUMBER + ": " + summary);
+
+/**************
+ * BEGIN TEST *
+ **************/
+
+function two(a, b) { }
+
+assertEq(Object.getOwnPropertyNames(two).indexOf("length") >= 0, true);
+
+var bound0 = Function.prototype.bind
+ ? two.bind("this")
+ : function two(a, b) { };
+
+assertEq(Object.getOwnPropertyNames(bound0).indexOf("length") >= 0, true);
+assertEq(bound0.length, 2);
+
+var bound1 = Function.prototype.bind
+ ? two.bind("this", 1)
+ : function one(a) { };
+
+assertEq(Object.getOwnPropertyNames(bound1).indexOf("length") >= 0, true);
+assertEq(bound1.length, 1);
+
+var bound2 = Function.prototype.bind
+ ? two.bind("this", 1, 2)
+ : function zero() { };
+
+assertEq(Object.getOwnPropertyNames(bound2).indexOf("length") >= 0, true);
+assertEq(bound2.length, 0);
+
+var bound3 = Function.prototype.bind
+ ? two.bind("this", 1, 2, 3)
+ : function zero() { };
+
+assertEq(Object.getOwnPropertyNames(bound3).indexOf("length") >= 0, true);
+assertEq(bound3.length, 0);
+
+
+/******************************************************************************/
+
+reportCompare(true, true);
+
+print("All tests passed!");
diff --git a/js/src/tests/ecma_5/Object/15.2.3.4-04.js b/js/src/tests/ecma_5/Object/15.2.3.4-04.js
new file mode 100644
index 000000000..2561c7aff
--- /dev/null
+++ b/js/src/tests/ecma_5/Object/15.2.3.4-04.js
@@ -0,0 +1,31 @@
+/*
+ * Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/licenses/publicdomain/
+ * Contributor:
+ * Jeff Walden <jwalden+code@mit.edu>
+ */
+
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 518663;
+var summary = 'Object.getOwnPropertyNames: regular expression objects';
+
+print(BUGNUMBER + ": " + summary);
+
+/**************
+ * BEGIN TEST *
+ **************/
+
+var actual = Object.getOwnPropertyNames(/a/);
+var expected = ["lastIndex"];
+
+for (var i = 0; i < expected.length; i++)
+{
+ reportCompare(actual.indexOf(expected[i]) >= 0, true,
+ expected[i] + " should be a property name on a RegExp");
+}
+
+/******************************************************************************/
+
+reportCompare(true, true);
+
+print("All tests passed!");
diff --git a/js/src/tests/ecma_5/Object/15.2.3.5-01.js b/js/src/tests/ecma_5/Object/15.2.3.5-01.js
new file mode 100644
index 000000000..70cfd64f5
--- /dev/null
+++ b/js/src/tests/ecma_5/Object/15.2.3.5-01.js
@@ -0,0 +1,60 @@
+/*
+ * Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/licenses/publicdomain/
+ */
+
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 492840;
+var summary = 'ES5 Object.create(O [, Properties])';
+
+print(BUGNUMBER + ": " + summary);
+
+/**************
+ * BEGIN TEST *
+ **************/
+
+assertEq("create" in Object, true);
+assertEq(Object.create.length, 2);
+
+var o, desc, props, proto;
+
+o = Object.create(null);
+assertEq(Object.getPrototypeOf(o), null, "bad null-proto");
+
+o = Object.create(null, { a: { value: 17, enumerable: false } });
+assertEq(Object.getPrototypeOf(o), null, "bad null-proto");
+assertEq("a" in o, true);
+desc = Object.getOwnPropertyDescriptor(o, "a");
+assertEq(desc !== undefined, true, "no descriptor?");
+assertEq(desc.value, 17);
+assertEq(desc.enumerable, false);
+assertEq(desc.configurable, false);
+assertEq(desc.writable, false);
+
+props = Object.create({ bar: 15 });
+Object.defineProperty(props, "foo", { enumerable: false, value: 42 });
+proto = { baz: 12 };
+o = Object.create(proto, props);
+assertEq(Object.getPrototypeOf(o), proto);
+assertEq(Object.getOwnPropertyDescriptor(o, "foo"), undefined);
+assertEq("foo" in o, false);
+assertEq(Object.getOwnPropertyDescriptor(o, "bar"), undefined);
+assertEq("bar" in o, false);
+assertEq(Object.getOwnPropertyDescriptor(o, "baz"), undefined);
+assertEq(o.baz, 12);
+assertEq(o.hasOwnProperty("baz"), false);
+
+try {
+ var actual =
+ Object.create(Object.create({},
+ { boom: { get: function() { return "base"; }}}),
+ { boom: { get: function() { return "overridden"; }}}).boom
+} catch (e) {
+}
+assertEq(actual, "overridden");
+
+/******************************************************************************/
+
+reportCompare(true, true);
+
+print("All tests passed!");
diff --git a/js/src/tests/ecma_5/Object/15.2.3.6-define-over-method.js b/js/src/tests/ecma_5/Object/15.2.3.6-define-over-method.js
new file mode 100644
index 000000000..1cc9e13e1
--- /dev/null
+++ b/js/src/tests/ecma_5/Object/15.2.3.6-define-over-method.js
@@ -0,0 +1,24 @@
+// Any copyright is dedicated to the Public Domain.
+// http://creativecommons.org/licenses/publicdomain/
+
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 568786;
+var summary =
+ 'Do not assert: !(attrs & (JSPROP_GETTER | JSPROP_SETTER)) with ' +
+ 'Object.defineProperty';
+
+print(BUGNUMBER + ": " + summary);
+
+/**************
+ * BEGIN TEST *
+ **************/
+
+var o = { x: function(){} };
+Object.defineProperty(o, "x", { get: function(){} });
+
+/******************************************************************************/
+
+if (typeof reportCompare === "function")
+ reportCompare(true, true);
+
+print("All tests passed!");
diff --git a/js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-01-of-32.js b/js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-01-of-32.js
new file mode 100644
index 000000000..d5ef02d02
--- /dev/null
+++ b/js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-01-of-32.js
@@ -0,0 +1,6 @@
+// |reftest| skip-if(!xulRuntime.shell) -- uses shell load() function
+// Any copyright is dedicated to the Public Domain.
+// http://creativecommons.org/licenses/publicdomain/
+
+load("ecma_5/Object/defineProperty-setup.js");
+runDictionaryPropertyPresentTestsFraction(1, 32);
diff --git a/js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-02-of-32.js b/js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-02-of-32.js
new file mode 100644
index 000000000..15ec6da11
--- /dev/null
+++ b/js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-02-of-32.js
@@ -0,0 +1,6 @@
+// |reftest| skip-if(!xulRuntime.shell) -- uses shell load() function
+// Any copyright is dedicated to the Public Domain.
+// http://creativecommons.org/licenses/publicdomain/
+
+load("ecma_5/Object/defineProperty-setup.js");
+runDictionaryPropertyPresentTestsFraction(2, 32);
diff --git a/js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-03-of-32.js b/js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-03-of-32.js
new file mode 100644
index 000000000..ee1c71e97
--- /dev/null
+++ b/js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-03-of-32.js
@@ -0,0 +1,6 @@
+// |reftest| skip-if(!xulRuntime.shell) -- uses shell load() function
+// Any copyright is dedicated to the Public Domain.
+// http://creativecommons.org/licenses/publicdomain/
+
+load("ecma_5/Object/defineProperty-setup.js");
+runDictionaryPropertyPresentTestsFraction(3, 32);
diff --git a/js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-04-of-32.js b/js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-04-of-32.js
new file mode 100644
index 000000000..b461f64cc
--- /dev/null
+++ b/js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-04-of-32.js
@@ -0,0 +1,6 @@
+// |reftest| skip-if(!xulRuntime.shell) -- uses shell load() function
+// Any copyright is dedicated to the Public Domain.
+// http://creativecommons.org/licenses/publicdomain/
+
+load("ecma_5/Object/defineProperty-setup.js");
+runDictionaryPropertyPresentTestsFraction(4, 32);
diff --git a/js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-05-of-32.js b/js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-05-of-32.js
new file mode 100644
index 000000000..710331f65
--- /dev/null
+++ b/js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-05-of-32.js
@@ -0,0 +1,6 @@
+// |reftest| skip-if(!xulRuntime.shell) -- uses shell load() function
+// Any copyright is dedicated to the Public Domain.
+// http://creativecommons.org/licenses/publicdomain/
+
+load("ecma_5/Object/defineProperty-setup.js");
+runDictionaryPropertyPresentTestsFraction(5, 32);
diff --git a/js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-06-of-32.js b/js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-06-of-32.js
new file mode 100644
index 000000000..930ead6bc
--- /dev/null
+++ b/js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-06-of-32.js
@@ -0,0 +1,6 @@
+// |reftest| skip-if(!xulRuntime.shell) -- uses shell load() function
+// Any copyright is dedicated to the Public Domain.
+// http://creativecommons.org/licenses/publicdomain/
+
+load("ecma_5/Object/defineProperty-setup.js");
+runDictionaryPropertyPresentTestsFraction(6, 32);
diff --git a/js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-07-of-32.js b/js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-07-of-32.js
new file mode 100644
index 000000000..bdf5dbcf3
--- /dev/null
+++ b/js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-07-of-32.js
@@ -0,0 +1,6 @@
+// |reftest| skip-if(!xulRuntime.shell) -- uses shell load() function
+// Any copyright is dedicated to the Public Domain.
+// http://creativecommons.org/licenses/publicdomain/
+
+load("ecma_5/Object/defineProperty-setup.js");
+runDictionaryPropertyPresentTestsFraction(7, 32);
diff --git a/js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-08-of-32.js b/js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-08-of-32.js
new file mode 100644
index 000000000..495d7b129
--- /dev/null
+++ b/js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-08-of-32.js
@@ -0,0 +1,6 @@
+// |reftest| skip-if(!xulRuntime.shell) -- uses shell load() function
+// Any copyright is dedicated to the Public Domain.
+// http://creativecommons.org/licenses/publicdomain/
+
+load("ecma_5/Object/defineProperty-setup.js");
+runDictionaryPropertyPresentTestsFraction(8, 32);
diff --git a/js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-09-of-32.js b/js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-09-of-32.js
new file mode 100644
index 000000000..d957644e8
--- /dev/null
+++ b/js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-09-of-32.js
@@ -0,0 +1,6 @@
+// |reftest| skip-if(!xulRuntime.shell) -- uses shell load() function
+// Any copyright is dedicated to the Public Domain.
+// http://creativecommons.org/licenses/publicdomain/
+
+load("ecma_5/Object/defineProperty-setup.js");
+runDictionaryPropertyPresentTestsFraction(9, 32);
diff --git a/js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-10-of-32.js b/js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-10-of-32.js
new file mode 100644
index 000000000..dcb147943
--- /dev/null
+++ b/js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-10-of-32.js
@@ -0,0 +1,6 @@
+// |reftest| skip-if(!xulRuntime.shell) -- uses shell load() function
+// Any copyright is dedicated to the Public Domain.
+// http://creativecommons.org/licenses/publicdomain/
+
+load("ecma_5/Object/defineProperty-setup.js");
+runDictionaryPropertyPresentTestsFraction(10, 32);
diff --git a/js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-11-of-32.js b/js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-11-of-32.js
new file mode 100644
index 000000000..d01dae494
--- /dev/null
+++ b/js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-11-of-32.js
@@ -0,0 +1,6 @@
+// |reftest| skip-if(!xulRuntime.shell) -- uses shell load() function
+// Any copyright is dedicated to the Public Domain.
+// http://creativecommons.org/licenses/publicdomain/
+
+load("ecma_5/Object/defineProperty-setup.js");
+runDictionaryPropertyPresentTestsFraction(11, 32);
diff --git a/js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-12-of-32.js b/js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-12-of-32.js
new file mode 100644
index 000000000..dc3c1e90c
--- /dev/null
+++ b/js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-12-of-32.js
@@ -0,0 +1,6 @@
+// |reftest| skip-if(!xulRuntime.shell) -- uses shell load() function
+// Any copyright is dedicated to the Public Domain.
+// http://creativecommons.org/licenses/publicdomain/
+
+load("ecma_5/Object/defineProperty-setup.js");
+runDictionaryPropertyPresentTestsFraction(12, 32);
diff --git a/js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-13-of-32.js b/js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-13-of-32.js
new file mode 100644
index 000000000..9f718ecd1
--- /dev/null
+++ b/js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-13-of-32.js
@@ -0,0 +1,6 @@
+// |reftest| skip-if(!xulRuntime.shell) -- uses shell load() function
+// Any copyright is dedicated to the Public Domain.
+// http://creativecommons.org/licenses/publicdomain/
+
+load("ecma_5/Object/defineProperty-setup.js");
+runDictionaryPropertyPresentTestsFraction(13, 32);
diff --git a/js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-14-of-32.js b/js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-14-of-32.js
new file mode 100644
index 000000000..97648ec04
--- /dev/null
+++ b/js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-14-of-32.js
@@ -0,0 +1,6 @@
+// |reftest| skip-if(!xulRuntime.shell) -- uses shell load() function
+// Any copyright is dedicated to the Public Domain.
+// http://creativecommons.org/licenses/publicdomain/
+
+load("ecma_5/Object/defineProperty-setup.js");
+runDictionaryPropertyPresentTestsFraction(14, 32);
diff --git a/js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-15-of-32.js b/js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-15-of-32.js
new file mode 100644
index 000000000..8c2fe7640
--- /dev/null
+++ b/js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-15-of-32.js
@@ -0,0 +1,6 @@
+// |reftest| skip-if(!xulRuntime.shell) -- uses shell load() function
+// Any copyright is dedicated to the Public Domain.
+// http://creativecommons.org/licenses/publicdomain/
+
+load("ecma_5/Object/defineProperty-setup.js");
+runDictionaryPropertyPresentTestsFraction(15, 32);
diff --git a/js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-16-of-32.js b/js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-16-of-32.js
new file mode 100644
index 000000000..dfdd97a2e
--- /dev/null
+++ b/js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-16-of-32.js
@@ -0,0 +1,6 @@
+// |reftest| skip-if(!xulRuntime.shell) -- uses shell load() function
+// Any copyright is dedicated to the Public Domain.
+// http://creativecommons.org/licenses/publicdomain/
+
+load("ecma_5/Object/defineProperty-setup.js");
+runDictionaryPropertyPresentTestsFraction(16, 32);
diff --git a/js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-17-of-32.js b/js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-17-of-32.js
new file mode 100644
index 000000000..ca8d67246
--- /dev/null
+++ b/js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-17-of-32.js
@@ -0,0 +1,6 @@
+// |reftest| skip-if(!xulRuntime.shell) -- uses shell load() function
+// Any copyright is dedicated to the Public Domain.
+// http://creativecommons.org/licenses/publicdomain/
+
+load("ecma_5/Object/defineProperty-setup.js");
+runDictionaryPropertyPresentTestsFraction(17, 32);
diff --git a/js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-18-of-32.js b/js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-18-of-32.js
new file mode 100644
index 000000000..34434cb23
--- /dev/null
+++ b/js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-18-of-32.js
@@ -0,0 +1,6 @@
+// |reftest| skip-if(!xulRuntime.shell) -- uses shell load() function
+// Any copyright is dedicated to the Public Domain.
+// http://creativecommons.org/licenses/publicdomain/
+
+load("ecma_5/Object/defineProperty-setup.js");
+runDictionaryPropertyPresentTestsFraction(18, 32);
diff --git a/js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-19-of-32.js b/js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-19-of-32.js
new file mode 100644
index 000000000..1f68fc15b
--- /dev/null
+++ b/js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-19-of-32.js
@@ -0,0 +1,6 @@
+// |reftest| skip-if(!xulRuntime.shell) -- uses shell load() function
+// Any copyright is dedicated to the Public Domain.
+// http://creativecommons.org/licenses/publicdomain/
+
+load("ecma_5/Object/defineProperty-setup.js");
+runDictionaryPropertyPresentTestsFraction(19, 32);
diff --git a/js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-20-of-32.js b/js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-20-of-32.js
new file mode 100644
index 000000000..c7aef96e6
--- /dev/null
+++ b/js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-20-of-32.js
@@ -0,0 +1,6 @@
+// |reftest| skip-if(!xulRuntime.shell) -- uses shell load() function
+// Any copyright is dedicated to the Public Domain.
+// http://creativecommons.org/licenses/publicdomain/
+
+load("ecma_5/Object/defineProperty-setup.js");
+runDictionaryPropertyPresentTestsFraction(20, 32);
diff --git a/js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-21-of-32.js b/js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-21-of-32.js
new file mode 100644
index 000000000..67861407c
--- /dev/null
+++ b/js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-21-of-32.js
@@ -0,0 +1,6 @@
+// |reftest| skip-if(!xulRuntime.shell) -- uses shell load() function
+// Any copyright is dedicated to the Public Domain.
+// http://creativecommons.org/licenses/publicdomain/
+
+load("ecma_5/Object/defineProperty-setup.js");
+runDictionaryPropertyPresentTestsFraction(21, 32);
diff --git a/js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-22-of-32.js b/js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-22-of-32.js
new file mode 100644
index 000000000..bfda5267c
--- /dev/null
+++ b/js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-22-of-32.js
@@ -0,0 +1,6 @@
+// |reftest| skip-if(!xulRuntime.shell) -- uses shell load() function
+// Any copyright is dedicated to the Public Domain.
+// http://creativecommons.org/licenses/publicdomain/
+
+load("ecma_5/Object/defineProperty-setup.js");
+runDictionaryPropertyPresentTestsFraction(22, 32);
diff --git a/js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-23-of-32.js b/js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-23-of-32.js
new file mode 100644
index 000000000..1f1b3e217
--- /dev/null
+++ b/js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-23-of-32.js
@@ -0,0 +1,6 @@
+// |reftest| skip-if(!xulRuntime.shell) -- uses shell load() function
+// Any copyright is dedicated to the Public Domain.
+// http://creativecommons.org/licenses/publicdomain/
+
+load("ecma_5/Object/defineProperty-setup.js");
+runDictionaryPropertyPresentTestsFraction(23, 32);
diff --git a/js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-24-of-32.js b/js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-24-of-32.js
new file mode 100644
index 000000000..0e553eef8
--- /dev/null
+++ b/js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-24-of-32.js
@@ -0,0 +1,6 @@
+// |reftest| skip-if(!xulRuntime.shell) -- uses shell load() function
+// Any copyright is dedicated to the Public Domain.
+// http://creativecommons.org/licenses/publicdomain/
+
+load("ecma_5/Object/defineProperty-setup.js");
+runDictionaryPropertyPresentTestsFraction(24, 32);
diff --git a/js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-25-of-32.js b/js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-25-of-32.js
new file mode 100644
index 000000000..1c013a99a
--- /dev/null
+++ b/js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-25-of-32.js
@@ -0,0 +1,6 @@
+// |reftest| skip-if(!xulRuntime.shell) -- uses shell load() function
+// Any copyright is dedicated to the Public Domain.
+// http://creativecommons.org/licenses/publicdomain/
+
+load("ecma_5/Object/defineProperty-setup.js");
+runDictionaryPropertyPresentTestsFraction(25, 32);
diff --git a/js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-26-of-32.js b/js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-26-of-32.js
new file mode 100644
index 000000000..51fad26b0
--- /dev/null
+++ b/js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-26-of-32.js
@@ -0,0 +1,6 @@
+// |reftest| skip-if(!xulRuntime.shell) -- uses shell load() function
+// Any copyright is dedicated to the Public Domain.
+// http://creativecommons.org/licenses/publicdomain/
+
+load("ecma_5/Object/defineProperty-setup.js");
+runDictionaryPropertyPresentTestsFraction(26, 32);
diff --git a/js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-27-of-32.js b/js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-27-of-32.js
new file mode 100644
index 000000000..6ff4b0461
--- /dev/null
+++ b/js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-27-of-32.js
@@ -0,0 +1,6 @@
+// |reftest| skip-if(!xulRuntime.shell) -- uses shell load() function
+// Any copyright is dedicated to the Public Domain.
+// http://creativecommons.org/licenses/publicdomain/
+
+load("ecma_5/Object/defineProperty-setup.js");
+runDictionaryPropertyPresentTestsFraction(27, 32);
diff --git a/js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-28-of-32.js b/js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-28-of-32.js
new file mode 100644
index 000000000..27f1137d9
--- /dev/null
+++ b/js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-28-of-32.js
@@ -0,0 +1,6 @@
+// |reftest| skip-if(!xulRuntime.shell) -- uses shell load() function
+// Any copyright is dedicated to the Public Domain.
+// http://creativecommons.org/licenses/publicdomain/
+
+load("ecma_5/Object/defineProperty-setup.js");
+runDictionaryPropertyPresentTestsFraction(28, 32);
diff --git a/js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-29-of-32.js b/js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-29-of-32.js
new file mode 100644
index 000000000..185e92fe1
--- /dev/null
+++ b/js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-29-of-32.js
@@ -0,0 +1,6 @@
+// |reftest| skip-if(!xulRuntime.shell) -- uses shell load() function
+// Any copyright is dedicated to the Public Domain.
+// http://creativecommons.org/licenses/publicdomain/
+
+load("ecma_5/Object/defineProperty-setup.js");
+runDictionaryPropertyPresentTestsFraction(29, 32);
diff --git a/js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-30-of-32.js b/js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-30-of-32.js
new file mode 100644
index 000000000..6c297b362
--- /dev/null
+++ b/js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-30-of-32.js
@@ -0,0 +1,6 @@
+// |reftest| skip-if(!xulRuntime.shell) -- uses shell load() function
+// Any copyright is dedicated to the Public Domain.
+// http://creativecommons.org/licenses/publicdomain/
+
+load("ecma_5/Object/defineProperty-setup.js");
+runDictionaryPropertyPresentTestsFraction(30, 32);
diff --git a/js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-31-of-32.js b/js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-31-of-32.js
new file mode 100644
index 000000000..b827b30ca
--- /dev/null
+++ b/js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-31-of-32.js
@@ -0,0 +1,6 @@
+// |reftest| skip-if(!xulRuntime.shell) -- uses shell load() function
+// Any copyright is dedicated to the Public Domain.
+// http://creativecommons.org/licenses/publicdomain/
+
+load("ecma_5/Object/defineProperty-setup.js");
+runDictionaryPropertyPresentTestsFraction(31, 32);
diff --git a/js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-32-of-32.js b/js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-32-of-32.js
new file mode 100644
index 000000000..5c44cff0d
--- /dev/null
+++ b/js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-32-of-32.js
@@ -0,0 +1,6 @@
+// |reftest| skip-if(!xulRuntime.shell) -- uses shell load() function
+// Any copyright is dedicated to the Public Domain.
+// http://creativecommons.org/licenses/publicdomain/
+
+load("ecma_5/Object/defineProperty-setup.js");
+runDictionaryPropertyPresentTestsFraction(32, 32);
diff --git a/js/src/tests/ecma_5/Object/15.2.3.6-function-length.js b/js/src/tests/ecma_5/Object/15.2.3.6-function-length.js
new file mode 100644
index 000000000..bc6475c1f
--- /dev/null
+++ b/js/src/tests/ecma_5/Object/15.2.3.6-function-length.js
@@ -0,0 +1,35 @@
+// |reftest| skip-if(!xulRuntime.shell) -- uses shell load() function
+// Any copyright is dedicated to the Public Domain.
+// http://creativecommons.org/licenses/publicdomain/
+
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 430133;
+var summary = 'ES5 Object.defineProperty(O, P, Attributes): Function.length';
+
+print(BUGNUMBER + ": " + summary);
+
+load("ecma_5/Object/defineProperty-setup.js");
+
+/**************
+ * BEGIN TEST *
+ **************/
+
+try
+{
+ new TestRunner().runFunctionLengthTests();
+}
+catch (e)
+{
+ throw "Error thrown during testing: " + e +
+ " at line " + e.lineNumber + "\n" +
+ (e.stack
+ ? "Stack: " + e.stack.split("\n").slice(2).join("\n") + "\n"
+ : "");
+}
+
+/******************************************************************************/
+
+if (typeof reportCompare === "function")
+ reportCompare(true, true);
+
+print("Tests complete!");
diff --git a/js/src/tests/ecma_5/Object/15.2.3.6-middle-redefinition-1-of-8.js b/js/src/tests/ecma_5/Object/15.2.3.6-middle-redefinition-1-of-8.js
new file mode 100644
index 000000000..fc1d0fca8
--- /dev/null
+++ b/js/src/tests/ecma_5/Object/15.2.3.6-middle-redefinition-1-of-8.js
@@ -0,0 +1,6 @@
+// |reftest| skip-if(!xulRuntime.shell) -- uses shell load() function
+// Any copyright is dedicated to the Public Domain.
+// http://creativecommons.org/licenses/publicdomain/
+
+load("ecma_5/Object/defineProperty-setup.js");
+runNonTerminalPropertyPresentTestsFraction(1, 8);
diff --git a/js/src/tests/ecma_5/Object/15.2.3.6-middle-redefinition-2-of-8.js b/js/src/tests/ecma_5/Object/15.2.3.6-middle-redefinition-2-of-8.js
new file mode 100644
index 000000000..4023e160d
--- /dev/null
+++ b/js/src/tests/ecma_5/Object/15.2.3.6-middle-redefinition-2-of-8.js
@@ -0,0 +1,6 @@
+// |reftest| skip-if(!xulRuntime.shell) -- uses shell load() function
+// Any copyright is dedicated to the Public Domain.
+// http://creativecommons.org/licenses/publicdomain/
+
+load("ecma_5/Object/defineProperty-setup.js");
+runNonTerminalPropertyPresentTestsFraction(2, 8);
diff --git a/js/src/tests/ecma_5/Object/15.2.3.6-middle-redefinition-3-of-8.js b/js/src/tests/ecma_5/Object/15.2.3.6-middle-redefinition-3-of-8.js
new file mode 100644
index 000000000..38b1d2876
--- /dev/null
+++ b/js/src/tests/ecma_5/Object/15.2.3.6-middle-redefinition-3-of-8.js
@@ -0,0 +1,6 @@
+// |reftest| skip-if(!xulRuntime.shell) -- uses shell load() function
+// Any copyright is dedicated to the Public Domain.
+// http://creativecommons.org/licenses/publicdomain/
+
+load("ecma_5/Object/defineProperty-setup.js");
+runNonTerminalPropertyPresentTestsFraction(3, 8);
diff --git a/js/src/tests/ecma_5/Object/15.2.3.6-middle-redefinition-4-of-8.js b/js/src/tests/ecma_5/Object/15.2.3.6-middle-redefinition-4-of-8.js
new file mode 100644
index 000000000..f3abac42e
--- /dev/null
+++ b/js/src/tests/ecma_5/Object/15.2.3.6-middle-redefinition-4-of-8.js
@@ -0,0 +1,6 @@
+// |reftest| skip-if(!xulRuntime.shell) -- uses shell load() function
+// Any copyright is dedicated to the Public Domain.
+// http://creativecommons.org/licenses/publicdomain/
+
+load("ecma_5/Object/defineProperty-setup.js");
+runNonTerminalPropertyPresentTestsFraction(4, 8);
diff --git a/js/src/tests/ecma_5/Object/15.2.3.6-middle-redefinition-5-of-8.js b/js/src/tests/ecma_5/Object/15.2.3.6-middle-redefinition-5-of-8.js
new file mode 100644
index 000000000..cce2114f5
--- /dev/null
+++ b/js/src/tests/ecma_5/Object/15.2.3.6-middle-redefinition-5-of-8.js
@@ -0,0 +1,6 @@
+// |reftest| skip-if(!xulRuntime.shell) -- uses shell load() function
+// Any copyright is dedicated to the Public Domain.
+// http://creativecommons.org/licenses/publicdomain/
+
+load("ecma_5/Object/defineProperty-setup.js");
+runNonTerminalPropertyPresentTestsFraction(5, 8);
diff --git a/js/src/tests/ecma_5/Object/15.2.3.6-middle-redefinition-6-of-8.js b/js/src/tests/ecma_5/Object/15.2.3.6-middle-redefinition-6-of-8.js
new file mode 100644
index 000000000..16c231c76
--- /dev/null
+++ b/js/src/tests/ecma_5/Object/15.2.3.6-middle-redefinition-6-of-8.js
@@ -0,0 +1,6 @@
+// |reftest| skip-if(!xulRuntime.shell) -- uses shell load() function
+// Any copyright is dedicated to the Public Domain.
+// http://creativecommons.org/licenses/publicdomain/
+
+load("ecma_5/Object/defineProperty-setup.js");
+runNonTerminalPropertyPresentTestsFraction(6, 8);
diff --git a/js/src/tests/ecma_5/Object/15.2.3.6-middle-redefinition-7-of-8.js b/js/src/tests/ecma_5/Object/15.2.3.6-middle-redefinition-7-of-8.js
new file mode 100644
index 000000000..bf3b2b49b
--- /dev/null
+++ b/js/src/tests/ecma_5/Object/15.2.3.6-middle-redefinition-7-of-8.js
@@ -0,0 +1,6 @@
+// |reftest| skip-if(!xulRuntime.shell) -- uses shell load() function
+// Any copyright is dedicated to the Public Domain.
+// http://creativecommons.org/licenses/publicdomain/
+
+load("ecma_5/Object/defineProperty-setup.js");
+runNonTerminalPropertyPresentTestsFraction(7, 8);
diff --git a/js/src/tests/ecma_5/Object/15.2.3.6-middle-redefinition-8-of-8.js b/js/src/tests/ecma_5/Object/15.2.3.6-middle-redefinition-8-of-8.js
new file mode 100644
index 000000000..7fa0b807d
--- /dev/null
+++ b/js/src/tests/ecma_5/Object/15.2.3.6-middle-redefinition-8-of-8.js
@@ -0,0 +1,6 @@
+// |reftest| skip-if(!xulRuntime.shell) -- uses shell load() function
+// Any copyright is dedicated to the Public Domain.
+// http://creativecommons.org/licenses/publicdomain/
+
+load("ecma_5/Object/defineProperty-setup.js");
+runNonTerminalPropertyPresentTestsFraction(8, 8);
diff --git a/js/src/tests/ecma_5/Object/15.2.3.6-miscellaneous.js b/js/src/tests/ecma_5/Object/15.2.3.6-miscellaneous.js
new file mode 100644
index 000000000..9f671c52c
--- /dev/null
+++ b/js/src/tests/ecma_5/Object/15.2.3.6-miscellaneous.js
@@ -0,0 +1,74 @@
+// Any copyright is dedicated to the Public Domain.
+// http://creativecommons.org/licenses/publicdomain/
+
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 430133;
+var summary = 'ES5 Object.defineProperty(O, P, Attributes)';
+
+print(BUGNUMBER + ": " + summary);
+
+/**************
+ * BEGIN TEST *
+ **************/
+
+var o = [];
+Object.defineProperty(o, 0, { value: 17 });
+var desc = Object.getOwnPropertyDescriptor(o, 0);
+assertEq(desc !== undefined, true);
+assertEq(desc.value, 17);
+assertEq(desc.enumerable, false);
+assertEq(desc.configurable, false);
+assertEq(desc.writable, false);
+
+desc = Object.getOwnPropertyDescriptor(o, "length");
+assertEq(desc !== undefined, true);
+assertEq(desc.enumerable, false);
+assertEq(desc.configurable, false);
+assertEq(desc.writable, true);
+assertEq(desc.value, 1);
+assertEq(o.length, 1);
+
+Object.defineProperty(o, "foobar",
+ { value: 42, enumerable: false, configurable: true });
+assertEq(o.foobar, 42);
+desc = Object.getOwnPropertyDescriptor(o, "foobar");
+assertEq(desc !== undefined, true);
+assertEq(desc.value, 42);
+assertEq(desc.configurable, true);
+assertEq(desc.enumerable, false);
+assertEq(desc.writable, false);
+
+var called = false;
+o = { set x(a) { called = true; } };
+Object.defineProperty(o, "x", { get: function() { return "get"; } });
+desc = Object.getOwnPropertyDescriptor(o, "x");
+assertEq("set" in desc, true);
+assertEq("get" in desc, true);
+assertEq(called, false);
+o.x = 13;
+assertEq(called, true);
+
+var toSource = Object.prototype.toSource || function() { };
+toSource.call(o); // a test for this not crashing
+
+var called = false;
+var o =
+ Object.defineProperty({}, "foo",
+ { get: function() { return 17; },
+ set: function(v) { called = true; } });
+
+assertEq(o.foo, 17);
+o.foo = 42;
+assertEq(called, true);
+
+/*
+ * XXX need tests for Object.defineProperty(array, "length", { ... }) when we
+ * support it!
+ */
+
+/******************************************************************************/
+
+if (typeof reportCompare === "function")
+ reportCompare(true, true);
+
+print("All tests passed!");
diff --git a/js/src/tests/ecma_5/Object/15.2.3.6-new-definition.js b/js/src/tests/ecma_5/Object/15.2.3.6-new-definition.js
new file mode 100644
index 000000000..ce5c38839
--- /dev/null
+++ b/js/src/tests/ecma_5/Object/15.2.3.6-new-definition.js
@@ -0,0 +1,35 @@
+// |reftest| skip-if(!xulRuntime.shell) -- uses shell load() function
+// Any copyright is dedicated to the Public Domain.
+// http://creativecommons.org/licenses/publicdomain/
+
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 430133;
+var summary = 'ES5 Object.defineProperty(O, P, Attributes): new definition';
+
+print(BUGNUMBER + ": " + summary);
+
+load("ecma_5/Object/defineProperty-setup.js");
+
+/**************
+ * BEGIN TEST *
+ **************/
+
+try
+{
+ new TestRunner().runNotPresentTests();
+}
+catch (e)
+{
+ throw "Error thrown during testing: " + e +
+ " at line " + e.lineNumber + "\n" +
+ (e.stack
+ ? "Stack: " + e.stack.split("\n").slice(2).join("\n") + "\n"
+ : "");
+}
+
+/******************************************************************************/
+
+if (typeof reportCompare === "function")
+ reportCompare(true, true);
+
+print("Tests complete!");
diff --git a/js/src/tests/ecma_5/Object/15.2.3.6-redefinition-1-of-4.js b/js/src/tests/ecma_5/Object/15.2.3.6-redefinition-1-of-4.js
new file mode 100644
index 000000000..55c11744d
--- /dev/null
+++ b/js/src/tests/ecma_5/Object/15.2.3.6-redefinition-1-of-4.js
@@ -0,0 +1,39 @@
+// |reftest| skip-if(!xulRuntime.shell) -- uses shell load() function
+// Any copyright is dedicated to the Public Domain.
+// http://creativecommons.org/licenses/publicdomain/
+
+var PART = 1, PARTS = 4;
+
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 430133;
+var summary =
+ 'ES5 Object.defineProperty(O, P, Attributes): redefinition ' +
+ PART + ' of ' + PARTS;
+
+print(BUGNUMBER + ": " + summary);
+
+load("ecma_5/Object/defineProperty-setup.js");
+
+/**************
+ * BEGIN TEST *
+ **************/
+
+try
+{
+ new TestRunner().runPropertyPresentTestsFraction(PART, PARTS);
+}
+catch (e)
+{
+ throw "Error thrown during testing: " + e +
+ " at line " + e.lineNumber + "\n" +
+ (e.stack
+ ? "Stack: " + e.stack.split("\n").slice(2).join("\n") + "\n"
+ : "");
+}
+
+/******************************************************************************/
+
+if (typeof reportCompare === "function")
+ reportCompare(true, true);
+
+print("Tests complete!");
diff --git a/js/src/tests/ecma_5/Object/15.2.3.6-redefinition-2-of-4.js b/js/src/tests/ecma_5/Object/15.2.3.6-redefinition-2-of-4.js
new file mode 100644
index 000000000..ef74b5582
--- /dev/null
+++ b/js/src/tests/ecma_5/Object/15.2.3.6-redefinition-2-of-4.js
@@ -0,0 +1,39 @@
+// |reftest| skip-if(!xulRuntime.shell) -- uses shell load() function
+// Any copyright is dedicated to the Public Domain.
+// http://creativecommons.org/licenses/publicdomain/
+
+var PART = 2, PARTS = 4;
+
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 430133;
+var summary =
+ 'ES5 Object.defineProperty(O, P, Attributes): redefinition ' +
+ PART + ' of ' + PARTS;
+
+print(BUGNUMBER + ": " + summary);
+
+load("ecma_5/Object/defineProperty-setup.js");
+
+/**************
+ * BEGIN TEST *
+ **************/
+
+try
+{
+ new TestRunner().runPropertyPresentTestsFraction(PART, PARTS);
+}
+catch (e)
+{
+ throw "Error thrown during testing: " + e +
+ " at line " + e.lineNumber + "\n" +
+ (e.stack
+ ? "Stack: " + e.stack.split("\n").slice(2).join("\n") + "\n"
+ : "");
+}
+
+/******************************************************************************/
+
+if (typeof reportCompare === "function")
+ reportCompare(true, true);
+
+print("Tests complete!");
diff --git a/js/src/tests/ecma_5/Object/15.2.3.6-redefinition-3-of-4.js b/js/src/tests/ecma_5/Object/15.2.3.6-redefinition-3-of-4.js
new file mode 100644
index 000000000..b0c58f3c2
--- /dev/null
+++ b/js/src/tests/ecma_5/Object/15.2.3.6-redefinition-3-of-4.js
@@ -0,0 +1,39 @@
+// |reftest| skip-if(!xulRuntime.shell) -- uses shell load() function
+// Any copyright is dedicated to the Public Domain.
+// http://creativecommons.org/licenses/publicdomain/
+
+var PART = 3, PARTS = 4;
+
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 430133;
+var summary =
+ 'ES5 Object.defineProperty(O, P, Attributes): redefinition ' +
+ PART + ' of ' + PARTS;
+
+print(BUGNUMBER + ": " + summary);
+
+load("ecma_5/Object/defineProperty-setup.js");
+
+/**************
+ * BEGIN TEST *
+ **************/
+
+try
+{
+ new TestRunner().runPropertyPresentTestsFraction(PART, PARTS);
+}
+catch (e)
+{
+ throw "Error thrown during testing: " + e +
+ " at line " + e.lineNumber + "\n" +
+ (e.stack
+ ? "Stack: " + e.stack.split("\n").slice(2).join("\n") + "\n"
+ : "");
+}
+
+/******************************************************************************/
+
+if (typeof reportCompare === "function")
+ reportCompare(true, true);
+
+print("Tests complete!");
diff --git a/js/src/tests/ecma_5/Object/15.2.3.6-redefinition-4-of-4.js b/js/src/tests/ecma_5/Object/15.2.3.6-redefinition-4-of-4.js
new file mode 100644
index 000000000..09994df43
--- /dev/null
+++ b/js/src/tests/ecma_5/Object/15.2.3.6-redefinition-4-of-4.js
@@ -0,0 +1,39 @@
+// |reftest| skip-if(!xulRuntime.shell) -- uses shell load() function
+// Any copyright is dedicated to the Public Domain.
+// http://creativecommons.org/licenses/publicdomain/
+
+var PART = 4, PARTS = 4;
+
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 430133;
+var summary =
+ 'ES5 Object.defineProperty(O, P, Attributes): redefinition ' +
+ PART + ' of ' + PARTS;
+
+print(BUGNUMBER + ": " + summary);
+
+load("ecma_5/Object/defineProperty-setup.js");
+
+/**************
+ * BEGIN TEST *
+ **************/
+
+try
+{
+ new TestRunner().runPropertyPresentTestsFraction(PART, PARTS);
+}
+catch (e)
+{
+ throw "Error thrown during testing: " + e +
+ " at line " + e.lineNumber + "\n" +
+ (e.stack
+ ? "Stack: " + e.stack.split("\n").slice(2).join("\n") + "\n"
+ : "");
+}
+
+/******************************************************************************/
+
+if (typeof reportCompare === "function")
+ reportCompare(true, true);
+
+print("Tests complete!");
diff --git a/js/src/tests/ecma_5/Object/15.2.3.7-01.js b/js/src/tests/ecma_5/Object/15.2.3.7-01.js
new file mode 100644
index 000000000..5220e1483
--- /dev/null
+++ b/js/src/tests/ecma_5/Object/15.2.3.7-01.js
@@ -0,0 +1,137 @@
+/*
+ * Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/licenses/publicdomain/
+ */
+
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 430133;
+var summary = 'ES5 Object.defineProperties(O, Properties)';
+
+print(BUGNUMBER + ": " + summary);
+
+/**************
+ * BEGIN TEST *
+ **************/
+
+assertEq("defineProperties" in Object, true);
+assertEq(Object.defineProperties.length, 2);
+
+var o, props, desc, passed;
+
+o = {};
+props =
+ {
+ a: { value: 17, enumerable: true, configurable: true, writable: true },
+ b: { value: 42, enumerable: false, configurable: false, writable: false }
+ };
+Object.defineProperties(o, props);
+assertEq("a" in o, true);
+assertEq("b" in o, true);
+desc = Object.getOwnPropertyDescriptor(o, "a");
+assertEq(desc.value, 17);
+assertEq(desc.enumerable, true);
+assertEq(desc.configurable, true);
+assertEq(desc.writable, true);
+desc = Object.getOwnPropertyDescriptor(o, "b");
+assertEq(desc.value, 42);
+assertEq(desc.enumerable, false);
+assertEq(desc.configurable, false);
+assertEq(desc.writable, false);
+
+props =
+ {
+ c: { value: NaN, enumerable: false, configurable: true, writable: true },
+ b: { value: 44 }
+ };
+var error = "before";
+try
+{
+ Object.defineProperties(o, props);
+ error = "no exception thrown";
+}
+catch (e)
+{
+ if (e instanceof TypeError)
+ error = "typeerror";
+ else
+ error = "bad exception: " + e;
+}
+assertEq(error, "typeerror", "didn't throw or threw wrongly");
+assertEq("c" in o, true, "new property added");
+assertEq(o.b, 42, "old property value preserved");
+
+function Properties() { }
+Properties.prototype = { b: { value: 42, enumerable: true } };
+props = new Properties();
+Object.defineProperty(props, "a", { enumerable: false });
+o = {};
+Object.defineProperties(o, props);
+assertEq("a" in o, false);
+assertEq(Object.getOwnPropertyDescriptor(o, "a"), undefined,
+ "Object.defineProperties(O, Properties) should only use enumerable " +
+ "properties on Properties");
+assertEq("b" in o, false);
+assertEq(Object.getOwnPropertyDescriptor(o, "b"), undefined,
+ "Object.defineProperties(O, Properties) should only use enumerable " +
+ "properties directly on Properties");
+
+Number.prototype.foo = { value: 17, enumerable: true };
+Boolean.prototype.bar = { value: 8675309, enumerable: true };
+String.prototype.quux = { value: "Are you HAPPY yet?", enumerable: true };
+o = {};
+Object.defineProperties(o, 5); // ToObject only throws for null/undefined
+assertEq("foo" in o, false, "foo is not an enumerable own property");
+Object.defineProperties(o, false);
+assertEq("bar" in o, false, "bar is not an enumerable own property");
+Object.defineProperties(o, "");
+assertEq("quux" in o, false, "quux is not an enumerable own property");
+
+error = "before";
+try
+{
+ Object.defineProperties(o, "1");
+}
+catch (e)
+{
+ if (e instanceof TypeError)
+ error = "typeerror";
+ else
+ error = "bad exception: " + e;
+}
+assertEq(error, "typeerror",
+ "should throw on Properties == '1' due to '1'[0] not being a " +
+ "property descriptor");
+
+error = "before";
+try
+{
+ Object.defineProperties(o, null);
+}
+catch (e)
+{
+ if (e instanceof TypeError)
+ error = "typeerror";
+ else
+ error = "bad exception: " + e;
+}
+assertEq(error, "typeerror", "should throw on Properties == null");
+
+error = "before";
+try
+{
+ Object.defineProperties(o, undefined);
+}
+catch (e)
+{
+ if (e instanceof TypeError)
+ error = "typeerror";
+ else
+ error = "bad exception: " + e;
+}
+assertEq(error, "typeerror", "should throw on Properties == undefined");
+
+/******************************************************************************/
+
+reportCompare(true, true);
+
+print("All tests passed!");
diff --git a/js/src/tests/ecma_5/Object/15.2.3.9.js b/js/src/tests/ecma_5/Object/15.2.3.9.js
new file mode 100644
index 000000000..c73437fa7
--- /dev/null
+++ b/js/src/tests/ecma_5/Object/15.2.3.9.js
@@ -0,0 +1,51 @@
+/*
+ * Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/licenses/publicdomain/
+ */
+
+/* Object.freeze */
+
+function getme() { return 42; };
+function setme(x) { };
+
+var properties = { all: { value:1, writable:true, configurable:true, enumerable: true },
+ readOnly: { value:2, writable:false, configurable:true, enumerable: true },
+ nonConfig: { value:3, writable:true, configurable:false, enumerable: true },
+ none: { value:4, writable:false, configurable:false, enumerable: true },
+ getter: { get: getme, configurable:false, enumerable: true },
+ setter: { set: setme, configurable:false, enumerable: true },
+ getandset: { get: getme, set: setme, configurable:false, enumerable: true }
+ };
+var o = Object.defineProperties({}, properties);
+
+Object.freeze(o);
+
+function getPropertyOf(obj) {
+ return function (prop) {
+ return Object.getOwnPropertyDescriptor(obj, prop);
+ };
+};
+
+assertEq(deepEqual(Object.getOwnPropertyDescriptor(o, 'all'),
+ { value: 1, writable:false, enumerable:true, configurable:false }),
+ true);
+assertEq(deepEqual(Object.getOwnPropertyDescriptor(o, 'readOnly'),
+ { value: 2, writable:false, enumerable:true, configurable:false }),
+ true);
+assertEq(deepEqual(Object.getOwnPropertyDescriptor(o, 'nonConfig'),
+ { value: 3, writable:false, enumerable:true, configurable:false }),
+ true);
+assertEq(deepEqual(Object.getOwnPropertyDescriptor(o, 'none'),
+ { value: 4, writable:false, enumerable:true, configurable:false }),
+ true);
+assertEq(deepEqual(Object.getOwnPropertyDescriptor(o, 'getter'),
+ { get: getme, set: (void 0), enumerable:true, configurable:false }),
+ true);
+assertEq(deepEqual(Object.getOwnPropertyDescriptor(o, 'setter'),
+ { set: setme, get: (void 0), enumerable:true, configurable:false }),
+ true);
+assertEq(deepEqual(Object.getOwnPropertyDescriptor(o, 'getandset'),
+ { get: getme, set: setme, enumerable:true, configurable:false }),
+ true);
+
+reportCompare(true, true);
diff --git a/js/src/tests/ecma_5/Object/add-property-non-extensible.js b/js/src/tests/ecma_5/Object/add-property-non-extensible.js
new file mode 100644
index 000000000..2089a5678
--- /dev/null
+++ b/js/src/tests/ecma_5/Object/add-property-non-extensible.js
@@ -0,0 +1,118 @@
+/*
+ * Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/licenses/publicdomain/
+ * Contributor:
+ * Jeff Walden <jwalden+code@mit.edu>
+ */
+
+var gTestfile = 'add-property-non-extensible.js';
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 602144;
+var summary =
+ 'Properly method-compile attempted addition of properties to ' +
+ 'non-extensible objects';
+
+print(BUGNUMBER + ": " + summary);
+
+/**************
+ * BEGIN TEST *
+ **************/
+
+// No property
+
+var o1 = {};
+for (var i = 0; i < 5; i++)
+ o1.a = 3;
+assertEq(o1.a, 3);
+
+var o2 = Object.preventExtensions({});
+for (var i = 0; i < 5; i++)
+ o2.a = 3;
+assertEq(Object.getOwnPropertyDescriptor(o2, "a"), undefined);
+
+var o3 = Object.seal({});
+for (var i = 0; i < 5; i++)
+ o3.a = 3;
+assertEq(Object.getOwnPropertyDescriptor(o3, "a"), undefined);
+
+var o4 = Object.freeze({});
+for (var i = 0; i < 5; i++)
+ o4.a = 3;
+assertEq(Object.getOwnPropertyDescriptor(o4, "a"), undefined);
+
+
+// Has property
+
+var o5 = { a: 2 };
+for (var i = 0; i < 5; i++)
+ o5.a = 3;
+assertEq(o5.a, 3);
+
+var o6 = Object.preventExtensions({ a: 2 });
+for (var i = 0; i < 5; i++)
+ o6.a = 3;
+assertEq(o6.a, 3);
+
+var o7 = Object.seal({ a: 2 });
+for (var i = 0; i < 5; i++)
+ o7.a = 3;
+assertEq(o7.a, 3);
+
+var o8 = Object.freeze({ a: 2 });
+for (var i = 0; i < 5; i++)
+ o8.a = 3;
+assertEq(o8.a, 2);
+
+
+// Extensible, hit up the prototype chain
+
+var o9 = Object.create({ a: 2 });
+for (var i = 0; i < 5; i++)
+ o9.a = 3;
+assertEq(o9.a, 3);
+
+var o10 = Object.create(Object.preventExtensions({ a: 2 }));
+for (var i = 0; i < 5; i++)
+ o10.a = 3;
+assertEq(o10.a, 3);
+
+var o11 = Object.create(Object.seal({ a: 2 }));
+for (var i = 0; i < 5; i++)
+ o11.a = 3;
+assertEq(o11.a, 3);
+
+var o12 = Object.create(Object.freeze({ a: 2 }));
+for (var i = 0; i < 5; i++)
+ o12.a = 3;
+assertEq(Object.getOwnPropertyDescriptor(o12, "a"), undefined);
+
+
+// Not extensible, hit up the prototype chain
+
+var o13 = Object.preventExtensions(Object.create({ a: 2 }));
+for (var i = 0; i < 5; i++)
+ o13.a = 3;
+assertEq(Object.getOwnPropertyDescriptor(o13, "a"), undefined);
+
+var o14 =
+ Object.preventExtensions(Object.create(Object.preventExtensions({ a: 2 })));
+for (var i = 0; i < 5; i++)
+ o14.a = 3;
+assertEq(Object.getOwnPropertyDescriptor(o14, "a"), undefined);
+
+var o15 = Object.preventExtensions(Object.create(Object.seal({ a: 2 })));
+for (var i = 0; i < 5; i++)
+ o15.a = 3;
+assertEq(Object.getOwnPropertyDescriptor(o15, "a"), undefined);
+
+var o16 = Object.preventExtensions(Object.create(Object.freeze({ a: 2 })));
+for (var i = 0; i < 5; i++)
+ o16.a = 3;
+assertEq(Object.getOwnPropertyDescriptor(o16, "a"), undefined);
+
+
+/******************************************************************************/
+
+reportCompare(true, true);
+
+print("All tests passed!");
diff --git a/js/src/tests/ecma_5/Object/browser.js b/js/src/tests/ecma_5/Object/browser.js
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/js/src/tests/ecma_5/Object/browser.js
diff --git a/js/src/tests/ecma_5/Object/clear-dictionary-accessor-getset.js b/js/src/tests/ecma_5/Object/clear-dictionary-accessor-getset.js
new file mode 100644
index 000000000..f0d9e11ca
--- /dev/null
+++ b/js/src/tests/ecma_5/Object/clear-dictionary-accessor-getset.js
@@ -0,0 +1,55 @@
+/*
+ * Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/licenses/publicdomain/
+ */
+
+var gTestfile = "clear-dictionary-accessor-getset.js";
+var BUGNUMBER = 1082662;
+var summary =
+ "Properly handle GC of a dictionary accessor property whose [[Get]] or " +
+ "[[Set]] has been changed to |undefined|";
+
+print(BUGNUMBER + ": " + summary);
+
+/**************
+ * BEGIN TEST *
+ **************/
+
+function test(field)
+{
+ var prop = "[[" + field[0].toUpperCase() + field.substring(1) + "]]";
+ print("Testing for GC crashes after setting " + prop + " to undefined...");
+
+ function inner()
+ {
+ // Create an object with an accessor property.
+ var obj = { x: 42, get y() {}, set y(v) {} };
+
+ // 1) convert it to dictionary mode, in the process 2) creating a new
+ // version of that accessor property whose [[Get]] and [[Set]] are objects
+ // that trigger post barriers.
+ delete obj.x;
+
+ var desc = {};
+ desc[field] = undefined;
+
+ // Overwrite [[field]] with undefined. Note #1 above is necessary so this
+ // is an actual *overwrite*, and not (possibly) a shape-tree fork that
+ // doesn't overwrite.
+ Object.defineProperty(obj, "y", desc);
+
+ }
+
+ inner();
+ gc(); // In unfixed code, this crashes trying to mark a null [[field]].
+}
+
+test("get");
+test("set");
+
+/******************************************************************************/
+
+if (typeof reportCompare === "function")
+ reportCompare(true, true);
+
+print("Tests complete");
diff --git a/js/src/tests/ecma_5/Object/defineProperties-callable-accessor.js b/js/src/tests/ecma_5/Object/defineProperties-callable-accessor.js
new file mode 100644
index 000000000..1e92a2c92
--- /dev/null
+++ b/js/src/tests/ecma_5/Object/defineProperties-callable-accessor.js
@@ -0,0 +1,19 @@
+// ObjectDefineProperties with non callable accessor throws.
+const descriptors = [
+ {get: 1}, {set: 1},
+ {get: []}, {set: []},
+ {get: {}}, {set: {}},
+ {get: new Number}, {set: new Number},
+
+ {get: 1, set: 1},
+ {get: [], set: []},
+ {get: {}, set: {}},
+ {get: new Number, set: new Number},
+];
+
+for (const descriptor of descriptors) {
+ assertThrowsInstanceOf(() => Object.create(null, {x: descriptor}), TypeError);
+ assertThrowsInstanceOf(() => Object.defineProperties({}, {x: descriptor}), TypeError);
+}
+
+reportCompare(true, true);
diff --git a/js/src/tests/ecma_5/Object/defineProperty-setup.js b/js/src/tests/ecma_5/Object/defineProperty-setup.js
new file mode 100644
index 000000000..da6fe8f49
--- /dev/null
+++ b/js/src/tests/ecma_5/Object/defineProperty-setup.js
@@ -0,0 +1,1071 @@
+// |reftest| skip -- not a test.
+// Any copyright is dedicated to the Public Domain.
+// http://creativecommons.org/licenses/publicdomain/
+
+assertEq("defineProperty" in Object, true);
+assertEq(Object.defineProperty.length, 3);
+
+/*
+ * Disable an assertion that is pathologically slow given the exhaustiveness of
+ * these tests.
+ */
+if (typeof enableStackWalkingAssertion === "function")
+ enableStackWalkingAssertion(false);
+
+if (!Object.prototype.toSource)
+{
+ Object.defineProperty(Object.prototype, "toSource",
+ {
+ value: function toSource()
+ {
+ if (this instanceof RegExp)
+ {
+ var v = "new RegExp(" + uneval(this.source);
+ var f = (this.multiline ? "m" : "") +
+ (this.global ? "g" : "") +
+ (this.ignoreCase ? "i" : "");
+ return v + (f ? ", '" + f + "'" : "") + ")";
+ }
+ return JSON.stringify(this);
+ },
+ enumerable: false,
+ configurable: true,
+ writable: true
+ });
+}
+if (!("uneval" in this))
+{
+ Object.defineProperty(this, "uneval",
+ {
+ value: function uneval(v)
+ {
+ if (v === null)
+ return "null";
+ if (typeof v === "object")
+ return v.toSource();
+ if (typeof v === "string")
+ {
+ v = JSON.stringify({v:v});
+ return v.substring(5, v.length - 1);
+ }
+ return "" + v;
+ },
+ enumerable: false,
+ configurable: true,
+ writable: true
+ });
+}
+
+// reimplemented for the benefit of engines which don't have this helper
+function assertEq(v1, v2, m)
+{
+ if (!SameValue(v1, v2))
+ {
+ throw "assertion failed: " +
+ "got " + uneval(v1) + ", expected " + uneval(v2) +
+ (m ? ": " + m : "");
+ }
+}
+
+function SameValue(v1, v2)
+{
+ if (v1 === 0 && v2 === 0)
+ return 1 / v1 === 1 / v2;
+ if (v1 !== v1 && v2 !== v2)
+ return true;
+ return v1 === v2;
+}
+
+function PropertyDescriptor(pd)
+{
+ if (pd)
+ this.update(pd);
+}
+PropertyDescriptor.prototype.update = function update(pd)
+{
+ if ("get" in pd)
+ this.get = pd.get;
+ if ("set" in pd)
+ this.set = pd.set;
+ if ("configurable" in pd)
+ this.configurable = pd.configurable;
+ if ("writable" in pd)
+ this.writable = pd.writable;
+ if ("enumerable" in pd)
+ this.enumerable = pd.enumerable;
+ if ("value" in pd)
+ this.value = pd.value;
+};
+PropertyDescriptor.prototype.convertToDataDescriptor = function convertToDataDescriptor()
+{
+ delete this.get;
+ delete this.set;
+ this.writable = false;
+ this.value = undefined;
+};
+PropertyDescriptor.prototype.convertToAccessorDescriptor = function convertToAccessorDescriptor()
+{
+ delete this.writable;
+ delete this.value;
+ this.get = undefined;
+ this.set = undefined;
+};
+
+function compareDescriptors(d1, d2)
+{
+ if (d1 === undefined)
+ {
+ assertEq(d2, undefined, "non-descriptors");
+ return;
+ }
+ if (d2 === undefined)
+ {
+ assertEq(true, false, "descriptor-equality mismatch: " + uneval(d1) + ", " + uneval(d2));
+ return;
+ }
+
+ var props = ["value", "get", "set", "enumerable", "configurable", "writable"];
+ for (var i = 0, sz = props.length; i < sz; i++)
+ {
+ var p = props[i];
+ assertEq(p in d1, p in d2, p + " different in d1/d2");
+ if (p in d1)
+ assertEq(d1[p], d2[p], p);
+ }
+}
+
+function examine(desc, field, allowDefault)
+{
+ if (field in desc)
+ return desc[field];
+ assertEq(allowDefault, true, "reimplementation error");
+ switch (field)
+ {
+ case "value":
+ case "get":
+ case "set":
+ return undefined;
+ case "writable":
+ case "enumerable":
+ case "configurable":
+ return false;
+ default:
+ assertEq(true, false, "bad field name: " + field);
+ }
+}
+
+function IsAccessorDescriptor(desc)
+{
+ if (!desc)
+ return false;
+ if (!("get" in desc) && !("set" in desc))
+ return false;
+ return true;
+}
+
+function IsDataDescriptor(desc)
+{
+ if (!desc)
+ return false;
+ if (!("value" in desc) && !("writable" in desc))
+ return false;
+ return true;
+}
+
+function IsGenericDescriptor(desc)
+{
+ if (!desc)
+ return false;
+ if (!IsAccessorDescriptor(desc) && !IsDataDescriptor(desc))
+ return true;
+ return false;
+}
+
+
+
+function CustomObject()
+{
+ this.properties = {};
+ this.extensible = true;
+}
+CustomObject.prototype =
+{
+ _reject: function _reject(throwing, msg)
+ {
+ if (throwing)
+ throw new TypeError(msg + "; rejected!");
+ return false;
+ },
+ defineOwnProperty: function defineOwnProperty(propname, desc, throwing)
+ {
+ assertEq(typeof propname, "string", "non-string propname");
+
+ // Step 1.
+ var current = this.properties[propname];
+
+ // Step 2.
+ var extensible = this.extensible;
+
+ // Step 3.
+ if (current === undefined && !extensible)
+ return this._reject(throwing, "object not extensible");
+
+ // Step 4.
+ if (current === undefined && extensible)
+ {
+ var p;
+ // Step 4(a).
+ if (IsGenericDescriptor(desc) || IsDataDescriptor(desc))
+ {
+ p = new PropertyDescriptor();
+ p.value = examine(desc, "value", true);
+ p.writable = examine(desc, "writable", true);
+ p.enumerable = examine(desc, "enumerable", true);
+ p.configurable = examine(desc, "configurable", true);
+ }
+ // Step 4(b).
+ else
+ {
+ p = new PropertyDescriptor();
+ p.get = examine(desc, "get", true);
+ p.set = examine(desc, "set", true);
+ p.enumerable = examine(desc, "enumerable", true);
+ p.configurable = examine(desc, "configurable", true);
+ }
+
+ this.properties[propname] = p;
+
+ // Step 4(c).
+ return true;
+ }
+
+ // Step 5.
+ if (!("value" in desc) && !("get" in desc) && !("set" in desc) &&
+ !("writable" in desc) && !("enumerable" in desc) &&
+ !("configurable" in desc))
+ {
+ return;
+ }
+
+ // Step 6.
+ do
+ {
+ if ("value" in desc)
+ {
+ if (!("value" in current) || !SameValue(desc.value, current.value))
+ break;
+ }
+ if ("get" in desc)
+ {
+ if (!("get" in current) || !SameValue(desc.get, current.get))
+ break;
+ }
+ if ("set" in desc)
+ {
+ if (!("set" in current) || !SameValue(desc.set, current.set))
+ break;
+ }
+ if ("writable" in desc)
+ {
+ if (!("writable" in current) ||
+ !SameValue(desc.writable, current.writable))
+ {
+ break;
+ }
+ }
+ if ("enumerable" in desc)
+ {
+ if (!("enumerable" in current) ||
+ !SameValue(desc.enumerable, current.enumerable))
+ {
+ break;
+ }
+ }
+ if ("configurable" in desc)
+ {
+ if (!("configurable" in current) ||
+ !SameValue(desc.configurable, current.configurable))
+ {
+ break;
+ }
+ }
+
+ // all fields in desc also in current, with the same values
+ return true;
+ }
+ while (false);
+
+ // Step 7.
+ if (!examine(current, "configurable"))
+ {
+ if ("configurable" in desc && examine(desc, "configurable"))
+ return this._reject(throwing, "can't make configurable again");
+ if ("enumerable" in desc &&
+ examine(current, "enumerable") !== examine(desc, "enumerable"))
+ {
+ return this._reject(throwing, "can't change enumerability");
+ }
+ }
+
+ // Step 8.
+ if (IsGenericDescriptor(desc))
+ {
+ // do nothing
+ }
+ // Step 9.
+ else if (IsDataDescriptor(current) !== IsDataDescriptor(desc))
+ {
+ // Step 9(a).
+ if (!examine(current, "configurable"))
+ return this._reject(throwing, "can't change unconfigurable descriptor's type");
+ // Step 9(b).
+ if (IsDataDescriptor(current))
+ current.convertToAccessorDescriptor();
+ // Step 9(c).
+ else
+ current.convertToDataDescriptor();
+ }
+ // Step 10.
+ else if (IsDataDescriptor(current) && IsDataDescriptor(desc))
+ {
+ // Step 10(a)
+ if (!examine(current, "configurable"))
+ {
+ // Step 10(a).i.
+ if (!examine(current, "writable") &&
+ "writable" in desc && examine(desc, "writable"))
+ {
+ return this._reject(throwing, "can't make data property writable again");
+ }
+ // Step 10(a).ii.
+ if (!examine(current, "writable"))
+ {
+ if ("value" in desc &&
+ !SameValue(examine(desc, "value"), examine(current, "value")))
+ {
+ return this._reject(throwing, "can't change value if not writable");
+ }
+ }
+ }
+ // Step 10(b).
+ else
+ {
+ assertEq(examine(current, "configurable"), true,
+ "spec bug step 10(b)");
+ }
+ }
+ // Step 11.
+ else
+ {
+ assertEq(IsAccessorDescriptor(current) && IsAccessorDescriptor(desc),
+ true,
+ "spec bug");
+
+ // Step 11(a).
+ if (!examine(current, "configurable"))
+ {
+ // Step 11(a).i.
+ if ("set" in desc &&
+ !SameValue(examine(desc, "set"), examine(current, "set")))
+ {
+ return this._reject(throwing, "can't change setter if not configurable");
+ }
+ // Step 11(a).ii.
+ if ("get" in desc &&
+ !SameValue(examine(desc, "get"), examine(current, "get")))
+ {
+ return this._reject(throwing, "can't change getter if not configurable");
+ }
+ }
+ }
+
+ // Step 12.
+ current.update(desc);
+
+ // Step 13.
+ return true;
+ }
+};
+
+function IsCallable(v)
+{
+ return typeof v === "undefined" || typeof v === "function";
+}
+
+var NativeTest =
+ {
+ newObject: function newObject()
+ {
+ return {};
+ },
+ defineProperty: function defineProperty(obj, propname, propdesc)
+ {
+ Object.defineProperty(obj, propname, propdesc);
+ },
+ getDescriptor: function getDescriptor(obj, propname)
+ {
+ return Object.getOwnPropertyDescriptor(obj, propname);
+ }
+ };
+
+var ReimplTest =
+ {
+ newObject: function newObject()
+ {
+ return new CustomObject();
+ },
+ defineProperty: function defineProperty(obj, propname, propdesc)
+ {
+ assertEq(obj instanceof CustomObject, true, "obj not instanceof CustomObject");
+ if ("get" in propdesc || "set" in propdesc)
+ {
+ if ("value" in propdesc || "writable" in propdesc)
+ throw new TypeError("get/set and value/writable");
+ if (!IsCallable(propdesc.get))
+ throw new TypeError("get defined, uncallable");
+ if (!IsCallable(propdesc.set))
+ throw new TypeError("set defined, uncallable");
+ }
+ return obj.defineOwnProperty(propname, propdesc, true);
+ },
+ getDescriptor: function getDescriptor(obj, propname)
+ {
+ if (!(propname in obj.properties))
+ return undefined;
+
+ return new PropertyDescriptor(obj.properties[propname]);
+ }
+ };
+
+var JSVAL_INT_MAX = Math.pow(2, 30) - 1;
+var JSVAL_INT_MIN = -Math.pow(2, 30);
+
+
+function isValidDescriptor(propdesc)
+{
+ if ("get" in propdesc || "set" in propdesc)
+ {
+ if ("value" in propdesc || "writable" in propdesc)
+ return false;
+
+ // We permit null here simply because this test's author believes the
+ // implementation may sometime be susceptible to making mistakes in this
+ // regard and would prefer to be cautious.
+ if (propdesc.get !== null && propdesc.get !== undefined && !IsCallable(propdesc.get))
+ return false;
+ if (propdesc.set !== null && propdesc.set !== undefined && !IsCallable(propdesc.set))
+ return false;
+ }
+
+ return true;
+}
+
+
+var OMIT = {};
+var VALUES =
+ [-Infinity, JSVAL_INT_MIN, -0, +0, 1.5, JSVAL_INT_MAX, Infinity,
+ NaN, "foo", "bar", null, undefined, true, false, {}, /a/, OMIT];
+var GETS =
+ [undefined, function get1() { return 1; }, function get2() { return 2; },
+ null, 5, OMIT];
+var SETS =
+ [undefined, function set1() { return 1; }, function set2() { return 2; },
+ null, 5, OMIT];
+var ENUMERABLES = [true, false, OMIT];
+var CONFIGURABLES = [true, false, OMIT];
+var WRITABLES = [true, false, OMIT];
+
+function mapTestDescriptors(filter)
+{
+ var descs = [];
+ var desc = {};
+
+ function put(field, value)
+ {
+ if (value !== OMIT)
+ desc[field] = value;
+ }
+
+ VALUES.forEach(function(value)
+ {
+ GETS.forEach(function(get)
+ {
+ SETS.forEach(function(set)
+ {
+ ENUMERABLES.forEach(function(enumerable)
+ {
+ CONFIGURABLES.forEach(function(configurable)
+ {
+ WRITABLES.forEach(function(writable)
+ {
+ desc = {};
+ put("value", value);
+ put("get", get);
+ put("set", set);
+ put("enumerable", enumerable);
+ put("configurable", configurable);
+ put("writable", writable);
+ if (filter(desc))
+ descs.push(desc);
+ });
+ });
+ });
+ });
+ });
+ });
+
+ return descs;
+}
+
+var ALL_DESCRIPTORS = mapTestDescriptors(function(d) { return true; });
+var VALID_DESCRIPTORS = mapTestDescriptors(isValidDescriptor);
+
+function TestRunner()
+{
+ this._logLines = [];
+}
+TestRunner.prototype =
+ {
+ // MAIN METHODS
+
+ runFunctionLengthTests: function runFunctionLengthTests()
+ {
+ var self = this;
+ function functionLengthTests()
+ {
+ self._fullFunctionLengthTests(() => Function("one", "/* body */"), 1);
+ self._fullFunctionLengthTests(() => function(one, two, three=null) { }, 2);
+ self._fullFunctionLengthTests(() => (one, two, ...etc) => 0, 2);
+ self._fullFunctionLengthTests(() => ({method(){}}.method), 0);
+ self._fullFunctionLengthTests(() => Object.getOwnPropertyDescriptor({set x(v){}}, "x").set, 1);
+ }
+
+ this._runTestSet(functionLengthTests, "Function length tests completed!");
+ },
+
+ runNotPresentTests: function runNotPresentTests()
+ {
+ var self = this;
+ function notPresentTests()
+ {
+ print("Running not-present tests now...");
+
+ for (var i = 0, sz = ALL_DESCRIPTORS.length; i < sz; i++)
+ self._runSingleNotPresentTest(ALL_DESCRIPTORS[i]);
+ };
+
+ this._runTestSet(notPresentTests, "Not-present length tests completed!");
+ },
+
+ runPropertyPresentTestsFraction:
+ function runPropertyPresentTestsFraction(part, parts)
+ {
+ var self = this;
+ function propertyPresentTests()
+ {
+ print("Running already-present tests now...");
+
+ var total = VALID_DESCRIPTORS.length;
+ var start = Math.floor((part - 1) / parts * total);
+ var end = Math.floor(part / parts * total);
+
+ for (var i = start; i < end; i++)
+ {
+ var old = VALID_DESCRIPTORS[i];
+ print("Starting test with old descriptor " + old.toSource() + "...");
+
+ for (var j = 0, sz2 = VALID_DESCRIPTORS.length; j < sz2; j++)
+ self._runSinglePropertyPresentTest(old, VALID_DESCRIPTORS[j], []);
+ }
+ }
+
+ this._runTestSet(propertyPresentTests,
+ "Property-present fraction " + part + " of " + parts +
+ " completed!");
+ },
+
+ runNonTerminalPropertyPresentTestsFraction:
+ function runNonTerminalPropertyPresentTestsFraction(part, parts)
+ {
+ var self = this;
+
+ /*
+ * A plain old property to define on the object before redefining the
+ * originally-added property, to test redefinition of a property that's
+ * not also lastProperty. NB: we could loop over every possible
+ * descriptor here if we wanted, even try adding more than one, but we'd
+ * hit cubic complexity and worse, and SpiderMonkey only distinguishes by
+ * the mere presence of the middle property, not its precise details.
+ */
+ var middleDefines =
+ [{
+ property: "middle",
+ descriptor:
+ { value: 17, writable: true, configurable: true, enumerable: true }
+ }];
+
+ function nonTerminalPropertyPresentTests()
+ {
+ print("Running non-terminal already-present tests now...");
+
+ var total = VALID_DESCRIPTORS.length;
+ var start = Math.floor((part - 1) / parts * total);
+ var end = Math.floor(part / parts * total);
+
+ for (var i = start; i < end; i++)
+ {
+ var old = VALID_DESCRIPTORS[i];
+ print("Starting test with old descriptor " + old.toSource() + "...");
+
+ for (var j = 0, sz2 = VALID_DESCRIPTORS.length; j < sz2; j++)
+ {
+ self._runSinglePropertyPresentTest(old, VALID_DESCRIPTORS[j],
+ middleDefines);
+ }
+ }
+ }
+
+ this._runTestSet(nonTerminalPropertyPresentTests,
+ "Non-terminal property-present fraction " +
+ part + " of " + parts + " completed!");
+ },
+
+ runDictionaryPropertyPresentTestsFraction:
+ function runDictionaryPropertyPresentTestsFraction(part, parts)
+ {
+ var self = this;
+
+ /*
+ * Add and readd properties such that the scope for the object is in
+ * dictionary mode.
+ */
+ var middleDefines =
+ [
+ {
+ property: "mid1",
+ descriptor:
+ { value: 17, writable: true, configurable: true, enumerable: true }
+ },
+ {
+ property: "mid2",
+ descriptor:
+ { value: 17, writable: true, configurable: true, enumerable: true }
+ },
+ {
+ property: "mid1",
+ descriptor:
+ { get: function g() { }, set: function s(v){}, configurable: false,
+ enumerable: true }
+ },
+ ];
+
+ function dictionaryPropertyPresentTests()
+ {
+ print("Running dictionary already-present tests now...");
+
+ var total = VALID_DESCRIPTORS.length;
+ var start = Math.floor((part - 1) / parts * total);
+ var end = Math.floor(part / parts * total);
+
+ for (var i = start; i < end; i++)
+ {
+ var old = VALID_DESCRIPTORS[i];
+ print("Starting test with old descriptor " + old.toSource() + "...");
+
+ for (var j = 0, sz2 = VALID_DESCRIPTORS.length; j < sz2; j++)
+ {
+ self._runSinglePropertyPresentTest(old, VALID_DESCRIPTORS[j],
+ middleDefines);
+ }
+ }
+ }
+
+ this._runTestSet(dictionaryPropertyPresentTests,
+ "Dictionary property-present fraction " +
+ part + " of " + parts + " completed!");
+ },
+
+
+ // HELPERS
+
+ runPropertyPresentTests: function runPropertyPresentTests()
+ {
+ print("Running already-present tests now...");
+
+ for (var i = 0, sz = VALID_DESCRIPTORS.length; i < sz; i++)
+ {
+ var old = VALID_DESCRIPTORS[i];
+ print("Starting test with old descriptor " + old.toSource() + "...");
+
+ for (var j = 0, sz2 = VALID_DESCRIPTORS.length; j < sz2; j++)
+ this._runSinglePropertyPresentTest(old, VALID_DESCRIPTORS[j], []);
+ }
+ },
+ _runTestSet: function _runTestSet(fun, completeMessage)
+ {
+ try
+ {
+ fun();
+
+ print(completeMessage);
+ }
+ catch (e)
+ {
+ print("ERROR, EXITING (line " + (e.lineNumber || -1) + "): " + e);
+ throw e;
+ }
+ finally
+ {
+ this._reportAllErrors();
+ }
+ },
+ _reportAllErrors: function _reportAllErrors()
+ {
+ var errorCount = this._logLines.length;
+ print("Full accumulated number of errors: " + errorCount);
+ if (errorCount > 0)
+ throw errorCount + " errors detected, FAIL";
+ },
+ _fullFunctionLengthTests: function _fullFunctionLengthTests(funFactory, len)
+ {
+ print("Running Function.length (" + funFactory + ") tests now...");
+
+ for (var i = 0, sz = VALID_DESCRIPTORS.length; i < sz; i++)
+ {
+ var desc = VALID_DESCRIPTORS[i];
+ this._runSingleFunctionLengthTest(funFactory(), len, desc);
+ }
+ },
+ _log: function _log(v)
+ {
+ var m = "" + v;
+ print(m);
+ this._logLines.push(m);
+ },
+ _runSingleNotPresentTest: function _runSingleNotPresentTest(desc)
+ {
+ var nativeObj = NativeTest.newObject();
+ var reimplObj = ReimplTest.newObject();
+
+ try
+ {
+ NativeTest.defineProperty(nativeObj, "foo", desc);
+ }
+ catch (e)
+ {
+ try
+ {
+ ReimplTest.defineProperty(reimplObj, "foo", desc);
+ }
+ catch (e2)
+ {
+ if (e.constructor !== e2.constructor)
+ {
+ this._log("Difference when comparing native/reimplementation " +
+ "behavior for new descriptor " + desc.toSource() +
+ ", native threw " + e + ", reimpl threw " + e2);
+ }
+ return;
+ }
+ this._log("Difference when comparing native/reimplementation " +
+ "behavior for new descriptor " + desc.toSource() +
+ ", error " + e);
+ return;
+ }
+
+ try
+ {
+ ReimplTest.defineProperty(reimplObj, "foo", desc);
+ }
+ catch (e)
+ {
+ this._log("Reimpl threw defining new descriptor " + desc.toSource() +
+ ", error: " + e);
+ return;
+ }
+
+ var nativeDesc = NativeTest.getDescriptor(nativeObj, "foo");
+ var reimplDesc = ReimplTest.getDescriptor(reimplObj, "foo");
+ try
+ {
+ compareDescriptors(nativeDesc, reimplDesc);
+ }
+ catch (e)
+ {
+ this._log("Difference comparing returned descriptors for new " +
+ "property defined with descriptor " + desc.toSource() +
+ "; error: " + e);
+ return;
+ }
+ },
+ _runSinglePropertyPresentTest:
+ function _runSinglePropertyPresentTest(old, add, middleDefines)
+ {
+ var nativeObj = NativeTest.newObject();
+ var reimplObj = ReimplTest.newObject();
+
+ try
+ {
+ NativeTest.defineProperty(nativeObj, "foo", old);
+ }
+ catch (e)
+ {
+ if (!SameValue(NativeTest.getDescriptor(nativeObj, "foo"), undefined))
+ {
+ this._log("defining bad property descriptor: " + old.toSource());
+ return;
+ }
+
+ try
+ {
+ ReimplTest.defineProperty(reimplObj, "foo", old);
+ }
+ catch (e2)
+ {
+ if (!SameValue(ReimplTest.getDescriptor(reimplObj, "foo"),
+ undefined))
+ {
+ this._log("defining bad property descriptor: " + old.toSource() +
+ "; reimplObj: " + uneval(reimplObj));
+ }
+
+ if (e.constructor !== e2.constructor)
+ {
+ this._log("Different errors defining bad property descriptor: " +
+ old.toSource() + "; native threw " + e + ", reimpl " +
+ "threw " + e2);
+ }
+
+ return;
+ }
+
+ this._log("Difference defining a property with descriptor " +
+ old.toSource() + ", error " + e);
+ return;
+ }
+
+ try
+ {
+ ReimplTest.defineProperty(reimplObj, "foo", old);
+ }
+ catch (e)
+ {
+ this._log("Difference when comparing native/reimplementation " +
+ "behavior when adding descriptor " + add.toSource() +
+ ", error: " + e);
+ return;
+ }
+
+ // Now add (or even readd) however many properties were specified between
+ // the original property to add and the new one, to test redefining
+ // non-last-properties and properties in scopes in dictionary mode.
+ for (var i = 0, sz = middleDefines.length; i < sz; i++)
+ {
+ var middle = middleDefines[i];
+ var prop = middle.property;
+ var desc = middle.descriptor;
+
+ try
+ {
+ NativeTest.defineProperty(nativeObj, prop, desc);
+ ReimplTest.defineProperty(reimplObj, prop, desc);
+ }
+ catch (e)
+ {
+ this._log("failure defining middle descriptor: " + desc.toSource() +
+ ", error " + e);
+ return;
+ }
+
+ // Sanity check
+ var nativeDesc = NativeTest.getDescriptor(nativeObj, prop);
+ var reimplDesc = ReimplTest.getDescriptor(reimplObj, prop);
+
+ compareDescriptors(nativeDesc, reimplDesc);
+ compareDescriptors(nativeDesc, desc);
+ }
+
+ try
+ {
+ NativeTest.defineProperty(nativeObj, "foo", add);
+ }
+ catch (e)
+ {
+ try
+ {
+ ReimplTest.defineProperty(reimplObj, "foo", add);
+ }
+ catch (e2)
+ {
+ if (e.constructor !== e2.constructor)
+ {
+ this._log("Difference when comparing native/reimplementation " +
+ "behavior for descriptor " + add.toSource() +
+ " overwriting descriptor " + old.toSource() + "; " +
+ "native threw " + e + ", reimpl threw " + e2);
+ }
+ return;
+ }
+ this._log("Difference when comparing native/reimplementation " +
+ "behavior for added descriptor " + add.toSource() + ", " +
+ "initial was " + old.toSource() + "; error: " + e);
+ return;
+ }
+
+ try
+ {
+ ReimplTest.defineProperty(reimplObj, "foo", add);
+ }
+ catch (e)
+ {
+ this._log("Difference when comparing native/reimplementation " +
+ "behavior for readded descriptor " + add.toSource() + ", " +
+ "initial was " + old.toSource() + "; native readd didn't " +
+ "throw, reimpl add did, error: " + e);
+ return;
+ }
+
+ var nativeDesc = NativeTest.getDescriptor(nativeObj, "foo");
+ var reimplDesc = ReimplTest.getDescriptor(reimplObj, "foo");
+ try
+ {
+ compareDescriptors(nativeDesc, reimplDesc);
+ }
+ catch (e)
+ {
+ this._log("Difference comparing returned descriptors for readded " +
+ "property defined with descriptor " + add.toSource() + "; " +
+ "initial was " + old.toSource() + "; error: " + e);
+ return;
+ }
+ },
+ _runSingleFunctionLengthTest: function _runSingleFunctionLengthTest(fun, len, desc)
+ {
+ var nativeObj = fun;
+ var reimplObj = ReimplTest.newObject();
+ ReimplTest.defineProperty(reimplObj, "length",
+ {
+ value: len,
+ enumerable: false,
+ configurable: true,
+ writable: false
+ });
+
+ try
+ {
+ NativeTest.defineProperty(nativeObj, "length", desc);
+ }
+ catch (e)
+ {
+ try
+ {
+ ReimplTest.defineProperty(reimplObj, "length", desc);
+ }
+ catch (e2)
+ {
+ if (e.constructor !== e2.constructor)
+ {
+ this._log("Difference when comparing native/reimplementation " +
+ "behavior defining fun.length with " + desc.toSource() +
+ "; native threw " + e + ", reimpl threw " + e2);
+ }
+ return;
+ }
+ this._log("Difference when comparing Function.length native/reimpl " +
+ "behavior for descriptor " + desc.toSource() +
+ ", native impl threw error " + e);
+ return;
+ }
+
+ try
+ {
+ ReimplTest.defineProperty(reimplObj, "length", desc);
+ }
+ catch (e)
+ {
+ this._log("Difference defining new Function.length descriptor: impl " +
+ "succeeded, reimpl threw for descriptor " +
+ desc.toSource() + ", error: " + e);
+ return;
+ }
+
+ var nativeDesc = NativeTest.getDescriptor(nativeObj, "length");
+ var reimplDesc = ReimplTest.getDescriptor(reimplObj, "length");
+ try
+ {
+ compareDescriptors(nativeDesc, reimplDesc);
+ }
+ catch (e)
+ {
+ this._log("Difference comparing returned descriptors for " +
+ "Function.length with descriptor " + desc.toSource() +
+ "; error: " + e);
+ return;
+ }
+ }
+ };
+
+function runDictionaryPropertyPresentTestsFraction(PART, PARTS)
+{
+ var testfile =
+ '15.2.3.6-dictionary-redefinition-' + PART + '-of-' + PARTS + '.js';
+ var BUGNUMBER = 560566;
+ var summary =
+ 'ES5 Object.defineProperty(O, P, Attributes): dictionary redefinition ' +
+ PART + ' of ' + PARTS;
+
+ print(BUGNUMBER + ": " + summary);
+
+ try
+ {
+ new TestRunner().runDictionaryPropertyPresentTestsFraction(PART, PARTS);
+ }
+ catch (e)
+ {
+ throw "Error thrown during testing: " + e +
+ " at line " + e.lineNumber + "\n" +
+ (e.stack
+ ? "Stack: " + e.stack.split("\n").slice(2).join("\n") + "\n"
+ : "");
+ }
+
+ if (typeof reportCompare === "function")
+ reportCompare(true, true);
+
+ print("Tests complete!");
+}
+
+function runNonTerminalPropertyPresentTestsFraction(PART, PARTS)
+{
+ var BUGNUMBER = 560566;
+ var summary =
+ 'ES5 Object.defineProperty(O, P, Attributes): middle redefinition ' +
+ PART + ' of ' + PARTS;
+
+ print(BUGNUMBER + ": " + summary);
+
+
+ /**************
+ * BEGIN TEST *
+ **************/
+
+ try
+ {
+ new TestRunner().runNonTerminalPropertyPresentTestsFraction(PART, PARTS);
+ }
+ catch (e)
+ {
+ throw "Error thrown during testing: " + e +
+ " at line " + e.lineNumber + "\n" +
+ (e.stack
+ ? "Stack: " + e.stack.split("\n").slice(2).join("\n") + "\n"
+ : "");
+ }
+
+ /******************************************************************************/
+
+ if (typeof reportCompare === "function")
+ reportCompare(true, true);
+
+ print("Tests complete!");
+}
diff --git a/js/src/tests/ecma_5/Object/extensibility-01.js b/js/src/tests/ecma_5/Object/extensibility-01.js
new file mode 100644
index 000000000..c001f3825
--- /dev/null
+++ b/js/src/tests/ecma_5/Object/extensibility-01.js
@@ -0,0 +1,103 @@
+/*
+ * Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/licenses/publicdomain/
+ * Contributor:
+ * Jeff Walden <jwalden+code@mit.edu>
+ */
+
+var gTestfile = '15.2.3.10-01.js';
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 492849;
+var summary = 'ES5: Implement Object.preventExtensions, Object.isExtensible';
+
+print(BUGNUMBER + ": " + summary);
+
+/**************
+ * BEGIN TEST *
+ **************/
+
+function trySetProperty(o, p, v, strict)
+{
+ function strictSetProperty()
+ {
+ "use strict";
+ o[p] = v;
+ }
+
+ function setProperty()
+ {
+ o[p] = v;
+ }
+
+ assertEq(Object.prototype.hasOwnProperty.call(o, p), false);
+
+ try
+ {
+ if (strict)
+ strictSetProperty();
+ else
+ setProperty();
+ if (o[p] === v)
+ return "set";
+ if (p in o)
+ return "set-converted";
+ return "swallowed";
+ }
+ catch (e)
+ {
+ return "throw";
+ }
+}
+
+function tryDefineProperty(o, p, v)
+{
+ assertEq(Object.prototype.hasOwnProperty.call(o, p), false);
+
+ try
+ {
+ Object.defineProperty(o, p, { value: v });
+ if (o[p] === v)
+ return "set";
+ if (p in o)
+ return "set-converted";
+ return "swallowed";
+ }
+ catch (e)
+ {
+ return "throw";
+ }
+}
+
+assertEq(typeof Object.preventExtensions, "function");
+assertEq(Object.preventExtensions.length, 1);
+
+var slowArray = [1, 2, 3];
+slowArray.slow = 5;
+var objs =
+ [{}, { 1: 2 }, { a: 3 }, [], [1], [, 1], slowArray, function a(){}, /a/];
+
+for (var i = 0, sz = objs.length; i < sz; i++)
+{
+ var o = objs[i];
+ assertEq(Object.isExtensible(o), true, "object " + i + " not extensible?");
+
+ var o2 = Object.preventExtensions(o);
+ assertEq(o, o2);
+
+ assertEq(Object.isExtensible(o), false, "object " + i + " is extensible?");
+
+ assertEq(trySetProperty(o, "baz", 17, true), "throw",
+ "unexpected behavior for strict-mode property-addition to " +
+ "object " + i);
+ assertEq(trySetProperty(o, "baz", 17, false), "swallowed",
+ "unexpected behavior for property-addition to object " + i);
+
+ assertEq(tryDefineProperty(o, "baz", 17), "throw",
+ "unexpected behavior for new property definition on object " + i);
+}
+
+/******************************************************************************/
+
+reportCompare(true, true);
+
+print("All tests passed!");
diff --git a/js/src/tests/ecma_5/Object/extensibility-02.js b/js/src/tests/ecma_5/Object/extensibility-02.js
new file mode 100644
index 000000000..c61e36728
--- /dev/null
+++ b/js/src/tests/ecma_5/Object/extensibility-02.js
@@ -0,0 +1,42 @@
+/*
+ * Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/licenses/publicdomain/
+ * Contributor:
+ * Jeff Walden <jwalden+code@mit.edu>
+ */
+
+var gTestfile = '15.2.3.4-01.js';
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 492849;
+var summary = 'ES5: Implement Object.preventExtensions, Object.isExtensible';
+
+print(BUGNUMBER + ": " + summary);
+
+/**************
+ * BEGIN TEST *
+ **************/
+
+assertEq(typeof Object.isExtensible, "function");
+assertEq(Object.isExtensible.length, 1);
+
+var slowArray = [1, 2, 3];
+slowArray.slow = 5;
+var objs =
+ [{}, { 1: 2 }, { a: 3 }, [], [1], [, 1], slowArray, function a(){}, /a/];
+
+for (var i = 0, sz = objs.length; i < sz; i++)
+{
+ var o = objs[i];
+ assertEq(Object.isExtensible(o), true, "object " + i + " not extensible?");
+
+ var o2 = Object.preventExtensions(o);
+ assertEq(o, o2);
+
+ assertEq(Object.isExtensible(o), false, "object " + i + " is extensible?");
+}
+
+/******************************************************************************/
+
+reportCompare(true, true);
+
+print("All tests passed!");
diff --git a/js/src/tests/ecma_5/Object/freeze-global-eval-const.js b/js/src/tests/ecma_5/Object/freeze-global-eval-const.js
new file mode 100644
index 000000000..a43f5c51c
--- /dev/null
+++ b/js/src/tests/ecma_5/Object/freeze-global-eval-const.js
@@ -0,0 +1,13 @@
+// |reftest| skip-if(!xulRuntime.shell) -- uses evalcx
+/*
+ * Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/licenses/publicdomain/
+ */
+
+try {
+ evalcx("Object.freeze(this); eval('const q = undefined;')");
+} catch (e) {
+ assertEq(e.message, "({lazy:false}) is not extensible");
+}
+
+reportCompare(0, 0, "don't crash");
diff --git a/js/src/tests/ecma_5/Object/gOPD-vs-prototype-accessor.js b/js/src/tests/ecma_5/Object/gOPD-vs-prototype-accessor.js
new file mode 100644
index 000000000..472887f90
--- /dev/null
+++ b/js/src/tests/ecma_5/Object/gOPD-vs-prototype-accessor.js
@@ -0,0 +1,15 @@
+/*
+ * Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/licenses/publicdomain/
+ */
+
+assertEq(function testcase() {
+ var proto = {};
+ Object.defineProperty(proto, "prop", {get: function () {return {};}, enumerable: true});
+ var ConstructFun = function () {};
+ ConstructFun.prototype = proto;
+ var child = new ConstructFun;
+ return Object.getOwnPropertyNames(child).indexOf('prop');
+}(), -1);
+
+reportCompare(0, 0, "ok");
diff --git a/js/src/tests/ecma_5/Object/getPrototypeOf-array.js b/js/src/tests/ecma_5/Object/getPrototypeOf-array.js
new file mode 100644
index 000000000..e482f89be
--- /dev/null
+++ b/js/src/tests/ecma_5/Object/getPrototypeOf-array.js
@@ -0,0 +1,32 @@
+/*
+ * Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/licenses/publicdomain/
+ */
+
+var gTestfile = 'getPrototypeOf-array.js';
+var BUGNUMBER = 769041;
+var summary =
+ "The [[Prototype]] of an object whose prototype chain contains an array " +
+ "isn't that array's [[Prototype]]";
+
+print(BUGNUMBER + ": " + summary);
+
+/**************
+ * BEGIN TEST *
+ **************/
+
+var arr = [];
+assertEq(Array.isArray(arr), true);
+var objWithArrPrototype = Object.create(arr);
+assertEq(!Array.isArray(objWithArrPrototype), true);
+assertEq(Object.getPrototypeOf(objWithArrPrototype), arr);
+var objWithArrGrandPrototype = Object.create(objWithArrPrototype);
+assertEq(!Array.isArray(objWithArrGrandPrototype), true);
+assertEq(Object.getPrototypeOf(objWithArrGrandPrototype), objWithArrPrototype);
+
+/******************************************************************************/
+
+if (typeof reportCompare === "function")
+ reportCompare(true, true);
+
+print("Tests complete");
diff --git a/js/src/tests/ecma_5/Object/isPrototypeOf.js b/js/src/tests/ecma_5/Object/isPrototypeOf.js
new file mode 100644
index 000000000..a2d78f650
--- /dev/null
+++ b/js/src/tests/ecma_5/Object/isPrototypeOf.js
@@ -0,0 +1,86 @@
+/*
+ * Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/licenses/publicdomain/
+ */
+
+var gTestfile = 'isPrototypeOf.js';
+var BUGNUMBER = 619283;
+var summary = "Object.prototype.isPrototypeOf";
+
+print(BUGNUMBER + ": " + summary);
+
+/**************
+ * BEGIN TEST *
+ **************/
+
+function expectThrowTypeError(fun)
+{
+ try
+ {
+ var r = fun();
+ throw new Error("didn't throw TypeError, returned " + r);
+ }
+ catch (e)
+ {
+ assertEq(e instanceof TypeError, true,
+ "didn't throw TypeError, got: " + e);
+ }
+}
+
+var isPrototypeOf = Object.prototype.isPrototypeOf;
+
+/*
+ * 1. If V is not an Object, return false.
+ */
+assertEq(isPrototypeOf(), false);
+assertEq(isPrototypeOf(1), false);
+assertEq(isPrototypeOf(Number.MAX_VALUE), false);
+assertEq(isPrototypeOf(NaN), false);
+assertEq(isPrototypeOf(""), false);
+assertEq(isPrototypeOf("sesquicentennial"), false);
+assertEq(isPrototypeOf(true), false);
+assertEq(isPrototypeOf(false), false);
+assertEq(isPrototypeOf(0.72), false);
+assertEq(isPrototypeOf(undefined), false);
+assertEq(isPrototypeOf(null), false);
+
+
+/*
+ * 2. Let O be the result of calling ToObject passing the this value as the
+ * argument.
+ */
+var protoGlobal = Object.create(this);
+expectThrowTypeError(function() { isPrototypeOf.call(null, {}); });
+expectThrowTypeError(function() { isPrototypeOf.call(undefined, {}); });
+expectThrowTypeError(function() { isPrototypeOf({}); });
+expectThrowTypeError(function() { isPrototypeOf.call(null, protoGlobal); });
+expectThrowTypeError(function() { isPrototypeOf.call(undefined, protoGlobal); });
+expectThrowTypeError(function() { isPrototypeOf(protoGlobal); });
+
+
+/*
+ * 3. Repeat
+ */
+
+/*
+ * 3a. Let V be the value of the [[Prototype]] internal property of V.
+ * 3b. If V is null, return false.
+ */
+assertEq(Object.prototype.isPrototypeOf(Object.prototype), false);
+assertEq(String.prototype.isPrototypeOf({}), false);
+assertEq(Object.prototype.isPrototypeOf(Object.create(null)), false);
+
+/* 3c. If O and V refer to the same object, return true. */
+assertEq(Object.prototype.isPrototypeOf({}), true);
+assertEq(this.isPrototypeOf(protoGlobal), true);
+assertEq(Object.prototype.isPrototypeOf({}), true);
+assertEq(Object.prototype.isPrototypeOf(new Number(17)), true);
+assertEq(Object.prototype.isPrototypeOf(function(){}), true);
+
+
+/******************************************************************************/
+
+if (typeof reportCompare === "function")
+ reportCompare(true, true);
+
+print("All tests passed!");
diff --git a/js/src/tests/ecma_5/Object/mutation-prevention-methods.js b/js/src/tests/ecma_5/Object/mutation-prevention-methods.js
new file mode 100644
index 000000000..01b4c19cb
--- /dev/null
+++ b/js/src/tests/ecma_5/Object/mutation-prevention-methods.js
@@ -0,0 +1,124 @@
+/*
+ * Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/licenses/publicdomain/
+ * Contributor:
+ * Jeff Walden <jwalden+code@mit.edu>
+ */
+
+var gTestfile = 'mutation-prevention-methods.js';
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 492849;
+var summary = 'Object.is{Sealed,Frozen}, Object.{seal,freeze}';
+
+print(BUGNUMBER + ": " + summary);
+
+/**************
+ * BEGIN TEST *
+ **************/
+
+// Empty object
+
+var o1 = {};
+
+assertEq(Object.isExtensible(o1), true);
+assertEq(Object.isSealed(o1), false);
+assertEq(Object.isFrozen(o1), false);
+
+Object.preventExtensions(o1);
+
+// An non-extensible empty object has no properties, so it is vacuously sealed
+// and frozen.
+assertEq(Object.isExtensible(o1), false);
+assertEq(Object.isSealed(o1), true);
+assertEq(Object.isFrozen(o1), true);
+
+
+// Object with a data property
+
+var o2 = { 1: 2 };
+
+assertEq(Object.isExtensible(o2), true);
+assertEq(Object.isSealed(o2), false);
+assertEq(Object.isFrozen(o2), false);
+
+Object.preventExtensions(o2);
+
+assertEq(Object.isExtensible(o2), false);
+assertEq(Object.isSealed(o2), false);
+assertEq(Object.isFrozen(o2), false);
+
+Object.seal(o2);
+
+assertEq(Object.isExtensible(o2), false);
+assertEq(Object.isSealed(o2), true);
+assertEq(Object.isFrozen(o2), false);
+
+assertEq(o2[1], 2);
+
+var desc;
+
+desc = Object.getOwnPropertyDescriptor(o2, "1");
+assertEq(typeof desc, "object");
+assertEq(desc.enumerable, true);
+assertEq(desc.configurable, false);
+assertEq(desc.value, 2);
+assertEq(desc.writable, true);
+
+o2[1] = 17;
+
+assertEq(o2[1], 17);
+
+desc = Object.getOwnPropertyDescriptor(o2, "1");
+assertEq(typeof desc, "object");
+assertEq(desc.enumerable, true);
+assertEq(desc.configurable, false);
+assertEq(desc.value, 17);
+assertEq(desc.writable, true);
+
+Object.freeze(o2);
+
+assertEq(o2[1], 17);
+
+desc = Object.getOwnPropertyDescriptor(o2, "1");
+assertEq(typeof desc, "object");
+assertEq(desc.enumerable, true);
+assertEq(desc.configurable, false);
+assertEq(desc.value, 17);
+assertEq(desc.writable, false);
+
+
+// Object with an accessor property
+
+var o3 = { get foo() { return 17; } };
+
+assertEq(Object.isExtensible(o3), true);
+assertEq(Object.isSealed(o3), false);
+assertEq(Object.isFrozen(o3), false);
+
+Object.preventExtensions(o3);
+
+assertEq(Object.isExtensible(o3), false);
+assertEq(Object.isSealed(o3), false);
+assertEq(Object.isFrozen(o3), false);
+
+Object.seal(o3);
+
+// An accessor property in a sealed object is unchanged if that object is
+// frozen, so a sealed object containing only accessor properties is also
+// vacuously frozen.
+assertEq(Object.isExtensible(o3), false);
+assertEq(Object.isSealed(o3), true);
+assertEq(Object.isFrozen(o3), true);
+
+Object.freeze(o3);
+
+assertEq(Object.isExtensible(o3), false);
+assertEq(Object.isSealed(o3), true);
+assertEq(Object.isFrozen(o3), true);
+
+
+/******************************************************************************/
+
+reportCompare(true, true);
+
+print("All tests passed!");
diff --git a/js/src/tests/ecma_5/Object/object-create-with-primitive-second-arg.js b/js/src/tests/ecma_5/Object/object-create-with-primitive-second-arg.js
new file mode 100644
index 000000000..44afd53c2
--- /dev/null
+++ b/js/src/tests/ecma_5/Object/object-create-with-primitive-second-arg.js
@@ -0,0 +1,8 @@
+[1, "", true, Symbol(), undefined].forEach(props => {
+ assertEq(Object.getPrototypeOf(Object.create(null, props)), null);
+});
+
+assertThrowsInstanceOf(() => Object.create(null, null), TypeError);
+
+if (typeof reportCompare === "function")
+ reportCompare(true, true);
diff --git a/js/src/tests/ecma_5/Object/object-toString-01.js b/js/src/tests/ecma_5/Object/object-toString-01.js
new file mode 100644
index 000000000..6a8c4e86a
--- /dev/null
+++ b/js/src/tests/ecma_5/Object/object-toString-01.js
@@ -0,0 +1,46 @@
+/*
+ * Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/licenses/publicdomain/
+ * Contributor:
+ * Jeff Walden <jwalden+code@mit.edu>
+ */
+
+var gTestfile = 'object-toString-01.js';
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 575522;
+var summary = '({}).toString.call(null) == "[object Null]", ' +
+ '({}).toString.call(undefined) == "[object Undefined]", ';
+
+print(BUGNUMBER + ": " + summary);
+
+/**************
+ * BEGIN TEST *
+ **************/
+
+var toString = Object.prototype.toString;
+
+assertEq(toString.call(null), "[object Null]");
+assertEq(toString.call(undefined), "[object Undefined]");
+
+assertEq(toString.call(true), "[object Boolean]");
+assertEq(toString.call(false), "[object Boolean]");
+
+assertEq(toString.call(0), "[object Number]");
+assertEq(toString.call(-0), "[object Number]");
+assertEq(toString.call(1), "[object Number]");
+assertEq(toString.call(-1), "[object Number]");
+assertEq(toString.call(NaN), "[object Number]");
+assertEq(toString.call(Infinity), "[object Number]");
+assertEq(toString.call(-Infinity), "[object Number]");
+
+assertEq(toString.call("foopy"), "[object String]");
+
+assertEq(toString.call({}), "[object Object]");
+
+
+/******************************************************************************/
+
+if (typeof reportCompare === "function")
+ reportCompare(true, true);
+
+print("All tests passed!");
diff --git a/js/src/tests/ecma_5/Object/preventExtensions-idempotent.js b/js/src/tests/ecma_5/Object/preventExtensions-idempotent.js
new file mode 100644
index 000000000..c0b16d890
--- /dev/null
+++ b/js/src/tests/ecma_5/Object/preventExtensions-idempotent.js
@@ -0,0 +1,30 @@
+/*
+ * Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/licenses/publicdomain/
+ * Contributor:
+ * Jeff Walden <jwalden+code@mit.edu>
+ */
+
+var gTestfile = 'preventExtensions-idempotent.js';
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 599459;
+var summary = 'Object.preventExtensions should be idempotent';
+
+print(BUGNUMBER + ": " + summary);
+
+/**************
+ * BEGIN TEST *
+ **************/
+
+var obj = {};
+assertEq(Object.preventExtensions(obj), obj);
+assertEq(Object.isExtensible(obj), false);
+assertEq(Object.preventExtensions(obj), obj);
+assertEq(Object.isExtensible(obj), false);
+
+/******************************************************************************/
+
+if (typeof reportCompare === "function")
+ reportCompare(true, true);
+
+print("All tests passed!");
diff --git a/js/src/tests/ecma_5/Object/propertyIsEnumerable.js b/js/src/tests/ecma_5/Object/propertyIsEnumerable.js
new file mode 100644
index 000000000..e9b09d0bf
--- /dev/null
+++ b/js/src/tests/ecma_5/Object/propertyIsEnumerable.js
@@ -0,0 +1,199 @@
+/*
+ * Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/licenses/publicdomain/
+ */
+
+var gTestfile = 'propertyIsEnumerable.js';
+var BUGNUMBER = 619283;
+var summary = "Object.prototype.propertyIsEnumerable";
+
+print(BUGNUMBER + ": " + summary);
+
+/**************
+ * BEGIN TEST *
+ **************/
+
+function expectThrowError(errorCtor, fun)
+{
+ try
+ {
+ var r = fun();
+ throw "didn't throw TypeError, returned " + r;
+ }
+ catch (e)
+ {
+ assertEq(e instanceof errorCtor, true,
+ "didn't throw " + errorCtor.prototype.name + ", got: " + e);
+ }
+}
+
+function expectThrowTypeError(fun)
+{
+ expectThrowError(TypeError, fun);
+}
+
+function withToString(fun)
+{
+ return { toString: fun };
+}
+
+function withValueOf(fun)
+{
+ return { toString: null, valueOf: fun };
+}
+
+var propertyIsEnumerable = Object.prototype.propertyIsEnumerable;
+
+/*
+ * 1. Let P be ToString(V).
+ */
+expectThrowError(ReferenceError, function()
+{
+ propertyIsEnumerable(withToString(function() { fahslkjdfhlkjdsl; }));
+});
+expectThrowError(ReferenceError, function()
+{
+ propertyIsEnumerable.call(null, withToString(function() { fahslkjdfhlkjdsl; }));
+});
+expectThrowError(ReferenceError, function()
+{
+ propertyIsEnumerable.call(undefined, withToString(function() { fahslkjdfhlkjdsl; }));
+});
+
+expectThrowError(ReferenceError, function()
+{
+ propertyIsEnumerable(withValueOf(function() { fahslkjdfhlkjdsl; }));
+});
+expectThrowError(ReferenceError, function()
+{
+ propertyIsEnumerable.call(null, withValueOf(function() { fahslkjdfhlkjdsl; }));
+});
+expectThrowError(ReferenceError, function()
+{
+ propertyIsEnumerable.call(undefined, withValueOf(function() { fahslkjdfhlkjdsl; }));
+});
+
+expectThrowError(SyntaxError, function()
+{
+ propertyIsEnumerable(withToString(function() { eval("}"); }));
+});
+expectThrowError(SyntaxError, function()
+{
+ propertyIsEnumerable.call(null, withToString(function() { eval("}"); }));
+});
+expectThrowError(SyntaxError, function()
+{
+ propertyIsEnumerable.call(undefined, withToString(function() { eval("}"); }));
+});
+
+expectThrowError(SyntaxError, function()
+{
+ propertyIsEnumerable(withValueOf(function() { eval("}"); }));
+});
+expectThrowError(SyntaxError, function()
+{
+ propertyIsEnumerable.call(null, withValueOf(function() { eval("}"); }));
+});
+expectThrowError(SyntaxError, function()
+{
+ propertyIsEnumerable.call(undefined, withValueOf(function() { eval("}"); }));
+});
+
+expectThrowError(RangeError, function()
+{
+ propertyIsEnumerable(withToString(function() { [].length = -1; }));
+});
+expectThrowError(RangeError, function()
+{
+ propertyIsEnumerable.call(null, withToString(function() { [].length = -1; }));
+});
+expectThrowError(RangeError, function()
+{
+ propertyIsEnumerable.call(undefined, withToString(function() { [].length = -1; }));
+});
+
+expectThrowError(RangeError, function()
+{
+ propertyIsEnumerable(withValueOf(function() { [].length = -1; }));
+});
+expectThrowError(RangeError, function()
+{
+ propertyIsEnumerable.call(null, withValueOf(function() { [].length = -1; }));
+});
+expectThrowError(RangeError, function()
+{
+ propertyIsEnumerable.call(undefined, withValueOf(function() { [].length = -1; }));
+});
+
+expectThrowError(RangeError, function()
+{
+ propertyIsEnumerable(withToString(function() { [].length = 0.7; }));
+});
+expectThrowError(RangeError, function()
+{
+ propertyIsEnumerable.call(null, withToString(function() { [].length = 0.7; }));
+});
+expectThrowError(RangeError, function()
+{
+ propertyIsEnumerable.call(undefined, withToString(function() { [].length = 0.7; }));
+});
+
+expectThrowError(RangeError, function()
+{
+ propertyIsEnumerable(withValueOf(function() { [].length = 0.7; }));
+});
+expectThrowError(RangeError, function()
+{
+ propertyIsEnumerable.call(null, withValueOf(function() { [].length = 0.7; }));
+});
+expectThrowError(RangeError, function()
+{
+ propertyIsEnumerable.call(undefined, withValueOf(function() { [].length = 0.7; }));
+});
+
+/*
+ * 2. Let O be the result of calling ToObject passing the this value as the
+ * argument.
+ */
+expectThrowTypeError(function() { propertyIsEnumerable("s"); });
+expectThrowTypeError(function() { propertyIsEnumerable.call(null, "s"); });
+expectThrowTypeError(function() { propertyIsEnumerable.call(undefined, "s"); });
+expectThrowTypeError(function() { propertyIsEnumerable(true); });
+expectThrowTypeError(function() { propertyIsEnumerable.call(null, true); });
+expectThrowTypeError(function() { propertyIsEnumerable.call(undefined, true); });
+expectThrowTypeError(function() { propertyIsEnumerable(NaN); });
+expectThrowTypeError(function() { propertyIsEnumerable.call(null, NaN); });
+expectThrowTypeError(function() { propertyIsEnumerable.call(undefined, NaN); });
+
+expectThrowTypeError(function() { propertyIsEnumerable({}); });
+expectThrowTypeError(function() { propertyIsEnumerable.call(null, {}); });
+expectThrowTypeError(function() { propertyIsEnumerable.call(undefined, {}); });
+
+/*
+ * 3. Let desc be the result of calling the [[GetOwnProperty]] internal method
+ * of O passing P as the argument.
+ * 4. If desc is undefined, return false.
+ */
+assertEq(propertyIsEnumerable.call({}, "valueOf"), false);
+assertEq(propertyIsEnumerable.call({}, "toString"), false);
+assertEq(propertyIsEnumerable.call("s", 1), false);
+assertEq(propertyIsEnumerable.call({}, "dsfiodjfs"), false);
+assertEq(propertyIsEnumerable.call(true, "toString"), false);
+assertEq(propertyIsEnumerable.call({}, "__proto__"), false);
+
+assertEq(propertyIsEnumerable.call(Object, "getOwnPropertyDescriptor"), false);
+assertEq(propertyIsEnumerable.call(this, "expectThrowTypeError"), true);
+assertEq(propertyIsEnumerable.call("s", "length"), false);
+assertEq(propertyIsEnumerable.call("s", 0), true);
+assertEq(propertyIsEnumerable.call(Number, "MAX_VALUE"), false);
+assertEq(propertyIsEnumerable.call({ x: 9 }, "x"), true);
+assertEq(propertyIsEnumerable.call(function() { }, "prototype"), false);
+assertEq(propertyIsEnumerable.call(function() { }, "length"), false);
+assertEq(propertyIsEnumerable.call(function() { "use strict"; }, "caller"), false);
+
+/******************************************************************************/
+
+if (typeof reportCompare === "function")
+ reportCompare(true, true);
+
+print("All tests passed!");
diff --git a/js/src/tests/ecma_5/Object/proto-property-change-writability-set.js b/js/src/tests/ecma_5/Object/proto-property-change-writability-set.js
new file mode 100644
index 000000000..d81f844e9
--- /dev/null
+++ b/js/src/tests/ecma_5/Object/proto-property-change-writability-set.js
@@ -0,0 +1,56 @@
+/*
+ * Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/licenses/publicdomain/
+ * Contributors:
+ * Gary Kwong
+ * Jeff Walden
+ * Jason Orendorff
+ */
+
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 713944;
+var summary =
+ "Don't assert anything about a shape from the property cache until it's " +
+ "known the cache entry matches";
+
+print(BUGNUMBER + ": " + summary);
+
+/**************
+ * BEGIN TEST *
+ **************/
+
+var accDesc = { set: function() {} };
+var dataDesc = { value: 3 };
+
+function f()
+{
+ propertyIsEnumerable = {};
+}
+function g()
+{
+ propertyIsEnumerable = {};
+}
+
+Object.defineProperty(Object.prototype, "propertyIsEnumerable", accDesc);
+f();
+Object.defineProperty(Object.prototype, "propertyIsEnumerable", dataDesc);
+assertEq(propertyIsEnumerable, 3);
+f();
+assertEq(propertyIsEnumerable, 3);
+g();
+assertEq(propertyIsEnumerable, 3);
+
+
+
+var a = { p1: 1, p2: 2 };
+var b = Object.create(a);
+Object.defineProperty(a, "p1", {set: function () {}});
+for (var i = 0; i < 2; i++)
+{
+ b.p1 = {};
+ Object.defineProperty(a, "p1", {value: 3});
+}
+assertEq(b.p1, 3);
+assertEq(a.p1, 3);
+
+reportCompare(true, true);
diff --git a/js/src/tests/ecma_5/Object/shell.js b/js/src/tests/ecma_5/Object/shell.js
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/js/src/tests/ecma_5/Object/shell.js
diff --git a/js/src/tests/ecma_5/Object/toLocaleString.js b/js/src/tests/ecma_5/Object/toLocaleString.js
new file mode 100644
index 000000000..e42c4a09e
--- /dev/null
+++ b/js/src/tests/ecma_5/Object/toLocaleString.js
@@ -0,0 +1,102 @@
+/*
+ * Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/licenses/publicdomain/
+ */
+
+var gTestfile = 'toLocaleString.js';
+var BUGNUMBER = 653789;
+var summary = "Object.prototype.toLocaleString";
+
+print(BUGNUMBER + ": " + summary);
+
+/**************
+ * BEGIN TEST *
+ **************/
+
+function expectThrowTypeError(fun)
+{
+ try
+ {
+ var r = fun();
+ throw "didn't throw TypeError, returned " + r;
+ }
+ catch (e)
+ {
+ assertEq(e instanceof TypeError, true,
+ "didn't throw TypeError, got: " + e);
+ }
+}
+
+var toLocaleString = Object.prototype.toLocaleString;
+
+/*
+ * 1. Let O be the result of calling ToObject passing the this value as the
+ * argument.
+ */
+expectThrowTypeError(function() { toLocaleString.call(null); });
+expectThrowTypeError(function() { toLocaleString.call(undefined); });
+expectThrowTypeError(function() { toLocaleString.apply(null); });
+expectThrowTypeError(function() { toLocaleString.apply(undefined); });
+
+
+/*
+ * 2. Let toString be the result of calling the [[Get]] internal method of O
+ * passing "toString" as the argument.
+ */
+try
+{
+ toLocaleString.call({ get toString() { throw 17; } });
+ throw new Error("didn't throw");
+}
+catch (e)
+{
+ assertEq(e, 17);
+}
+
+
+/* 3. If IsCallable(toString) is false, throw a TypeError exception. */
+expectThrowTypeError(function() { toLocaleString.call({ toString: 12 }); });
+expectThrowTypeError(function() { toLocaleString.call({ toString: 0.3423423452352e9 }); });
+expectThrowTypeError(function() { toLocaleString.call({ toString: undefined }); });
+expectThrowTypeError(function() { toLocaleString.call({ toString: false }); });
+expectThrowTypeError(function() { toLocaleString.call({ toString: [] }); });
+expectThrowTypeError(function() { toLocaleString.call({ toString: {} }); });
+expectThrowTypeError(function() { toLocaleString.call({ toString: new String }); });
+expectThrowTypeError(function() { toLocaleString.call({ toString: new Number(7.7) }); });
+expectThrowTypeError(function() { toLocaleString.call({ toString: new Boolean(true) }); });
+expectThrowTypeError(function() { toLocaleString.call({ toString: JSON }); });
+
+expectThrowTypeError(function() { toLocaleString.call({ valueOf: 0, toString: 12 }); });
+expectThrowTypeError(function() { toLocaleString.call({ valueOf: 0, toString: 0.3423423452352e9 }); });
+expectThrowTypeError(function() { toLocaleString.call({ valueOf: 0, toString: undefined }); });
+expectThrowTypeError(function() { toLocaleString.call({ valueOf: 0, toString: false }); });
+expectThrowTypeError(function() { toLocaleString.call({ valueOf: 0, toString: [] }); });
+expectThrowTypeError(function() { toLocaleString.call({ valueOf: 0, toString: {} }); });
+expectThrowTypeError(function() { toLocaleString.call({ valueOf: 0, toString: new String }); });
+expectThrowTypeError(function() { toLocaleString.call({ valueOf: 0, toString: new Number(7.7) }); });
+expectThrowTypeError(function() { toLocaleString.call({ valueOf: 0, toString: new Boolean(true) }); });
+expectThrowTypeError(function() { toLocaleString.call({ valueOf: 0, toString: JSON }); });
+
+
+/*
+ * 4. Return the result of calling the [[Call]] internal method of toString
+ * passing O as the this value and no arguments.
+ */
+assertEq(toLocaleString.call({ get toString() { return function() { return "foo"; } } }),
+ "foo");
+
+var obj = { toString: function() { assertEq(this, obj); assertEq(arguments.length, 0); return 5; } };
+assertEq(toLocaleString.call(obj), 5);
+
+assertEq(toLocaleString.call({ toString: function() { return obj; } }), obj);
+
+assertEq(toLocaleString.call({ toString: function() { return obj; },
+ valueOf: function() { return "abc"; } }),
+ obj);
+
+/******************************************************************************/
+
+if (typeof reportCompare === "function")
+ reportCompare(true, true);
+
+print("All tests passed!");
diff --git a/js/src/tests/ecma_5/Object/vacuous-accessor-unqualified-name.js b/js/src/tests/ecma_5/Object/vacuous-accessor-unqualified-name.js
new file mode 100644
index 000000000..768b1050b
--- /dev/null
+++ b/js/src/tests/ecma_5/Object/vacuous-accessor-unqualified-name.js
@@ -0,0 +1,26 @@
+/*
+ * Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/licenses/publicdomain/
+ */
+
+var gTestfile = 'vacuous-accessor-unqualified-name.js';
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 560216;
+var summary =
+ "Using a name referring to a { get: undefined, set: undefined } descriptor " +
+ "shouldn't assert";
+
+print(BUGNUMBER + ": " + summary);
+
+/**************
+ * BEGIN TEST *
+ **************/
+
+Object.defineProperty(this, "x", { set: undefined, configurable: true });
+x;
+
+/******************************************************************************/
+
+reportCompare(true, true);
+
+print("All tests passed!");