js/src/jit-test/tests/debug/Object-getOwnPropertyNames-01.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 // Basic getOwnPropertyNames tests.
michael@0 2
michael@0 3 var g = newGlobal();
michael@0 4 var dbg = Debugger();
michael@0 5 var gobj = dbg.addDebuggee(g);
michael@0 6
michael@0 7 function test(code) {
michael@0 8 code = "(" + code + ");";
michael@0 9 var expected = Object.getOwnPropertyNames(eval(code));
michael@0 10 g.eval("obj = " + code);
michael@0 11 var actual = gobj.getOwnPropertyDescriptor("obj").value.getOwnPropertyNames();
michael@0 12 assertEq(JSON.stringify(actual.sort()), JSON.stringify(expected.sort()));
michael@0 13 }
michael@0 14
michael@0 15 test("{}");
michael@0 16 test("{a: 0, b: 1}");
michael@0 17 test("{'name with space': 0}");
michael@0 18 test("{get x() {}, set y(v) {}}");
michael@0 19 test("{get x() { throw 'fit'; }}");
michael@0 20 test("Object.create({a: 1})");
michael@0 21 test("Object.create({get a() {}, set a(v) {}})");
michael@0 22 test("(function () { var x = {a: 0, b: 1}; delete a; return x; })()");
michael@0 23 test("Object.create(null, {x: {value: 0}})");
michael@0 24 test("[]");
michael@0 25 test("[0, 1, 2]");
michael@0 26 test("[,,,,,]");
michael@0 27 test("/a*a/");
michael@0 28 test("function () {}");

mercurial