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

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/js/src/jit-test/tests/debug/Object-unwrap-01.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,23 @@
     1.4 +// Check Debugger.Object.prototype.unwrap surfaces.
     1.5 +
     1.6 +load(libdir + 'asserts.js');
     1.7 +
     1.8 +var dbg = new Debugger();
     1.9 +var g = newGlobal();
    1.10 +var gw = dbg.addDebuggee(g);
    1.11 +
    1.12 +assertEq(Object.getOwnPropertyDescriptor(gw, 'unwrap'), undefined);
    1.13 +var d = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(gw), 'unwrap');
    1.14 +assertEq(d.enumerable, false);
    1.15 +assertEq(d.configurable, true);
    1.16 +assertEq(d.writable, true);
    1.17 +
    1.18 +assertEq(typeof gw.unwrap, "function");
    1.19 +assertEq(gw.unwrap.length, 0);
    1.20 +assertEq(gw.unwrap.name, "unwrap");
    1.21 +
    1.22 +// It can be called.
    1.23 +gw.unwrap();
    1.24 +
    1.25 +// You shouldn't be able to apply the accessor to the prototype.
    1.26 +assertThrowsInstanceOf(function () { Debugger.Object.prototype.unwrap(); }, TypeError);

mercurial