Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
1 // Basic getOwnPropertyNames tests.
3 var g = newGlobal();
4 var dbg = Debugger();
5 var gobj = dbg.addDebuggee(g);
7 function test(code) {
8 code = "(" + code + ");";
9 var expected = Object.getOwnPropertyNames(eval(code));
10 g.eval("obj = " + code);
11 var actual = gobj.getOwnPropertyDescriptor("obj").value.getOwnPropertyNames();
12 assertEq(JSON.stringify(actual.sort()), JSON.stringify(expected.sort()));
13 }
15 test("{}");
16 test("{a: 0, b: 1}");
17 test("{'name with space': 0}");
18 test("{get x() {}, set y(v) {}}");
19 test("{get x() { throw 'fit'; }}");
20 test("Object.create({a: 1})");
21 test("Object.create({get a() {}, set a(v) {}})");
22 test("(function () { var x = {a: 0, b: 1}; delete a; return x; })()");
23 test("Object.create(null, {x: {value: 0}})");
24 test("[]");
25 test("[0, 1, 2]");
26 test("[,,,,,]");
27 test("/a*a/");
28 test("function () {}");