js/src/jit-test/tests/debug/Frame-onPop-17.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.

     1 // onPop surfaces.
     2 load(libdir + "asserts.js");
     4 var g = newGlobal();
     5 var dbg = new Debugger(g);
     7 // Assigning a bogus value to Debugger.Frame.prototype.onPop raises a TypeError.
     8 function test(badValue) {
     9     print("store " + uneval(badValue) + " in Debugger.Frame.prototype.onPop");
    11     var log;
    12     dbg.onDebuggerStatement = function handleDebugger(frame) {
    13         log += "d";
    14         assertThrowsInstanceOf(function () { frame.onPop = badValue; }, TypeError);
    15     };
    17     log = "";
    18     g.eval("debugger");
    19     assertEq(log, "d");
    20 }
    22 test(null);
    23 test(false);
    24 test(1);
    25 test("stringy");
    26 test({});
    27 test([]);
    29 // Getting and setting the prototype's onPop is an error.
    30 assertThrowsInstanceOf(function () { Debugger.Frame.prototype.onPop; }, TypeError);
    31 assertThrowsInstanceOf(
    32     function () { Debugger.Frame.prototype.onPop = function () {}; },
    33     TypeError);
    35 // The getters and setters correctly check the type of their 'this' argument.
    36 var descriptor = Object.getOwnPropertyDescriptor(Debugger.Frame.prototype, 'onPop');
    37 assertEq(descriptor.configurable, true);
    38 assertEq(descriptor.enumerable, false);
    39 assertThrowsInstanceOf(function () { descriptor.get.call({}); }, TypeError);
    40 assertThrowsInstanceOf(function () { descriptor.set.call({}, function() {}); }, TypeError);

mercurial