js/src/jit-test/tests/debug/surfaces-offsets.js

Thu, 15 Jan 2015 21:03:48 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 21:03:48 +0100
branch
TOR_BUG_9701
changeset 11
deefc01c0e14
permissions
-rw-r--r--

Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)

     1 // Invalid offsets result in exceptions, not bogus results.
     3 load(libdir + "asserts.js");
     5 var g = newGlobal();
     6 var dbg = Debugger(g);
     7 var hits;
     8 dbg.onDebuggerStatement = function (frame) {
     9     assertEq(frame.script.getOffsetLine(frame.offset), g.line);
    10     assertThrowsInstanceOf(function () { frame.script.getOffsetLine(String(frame.offset)); }, Error);
    11     assertThrowsInstanceOf(function () { frame.script.getOffsetLine(Object(frame.offset)); }, Error);
    13     assertThrowsInstanceOf(function () { frame.script.getOffsetLine(-1); }, Error);
    14     assertThrowsInstanceOf(function () { frame.script.getOffsetLine(1000000); }, Error);
    15     assertThrowsInstanceOf(function () { frame.script.getOffsetLine(0.25); }, Error);
    16     assertThrowsInstanceOf(function () { frame.script.getOffsetLine(+Infinity); }, Error);
    17     assertThrowsInstanceOf(function () { frame.script.getOffsetLine(-Infinity); }, Error);
    18     assertThrowsInstanceOf(function () { frame.script.getOffsetLine(NaN); }, Error);
    20     assertThrowsInstanceOf(function () { frame.script.getOffsetLine(false); }, Error);
    21     assertThrowsInstanceOf(function () { frame.script.getOffsetLine(true); }, Error);
    22     assertThrowsInstanceOf(function () { frame.script.getOffsetLine(undefined); }, Error);
    23     assertThrowsInstanceOf(function () { frame.script.getOffsetLine(); }, Error);
    25     // We assume that at least one whole number between 0 and frame.offset is invalid.
    26     assertThrowsInstanceOf(
    27         function () {
    28             for (var i = 0; i < frame.offset; i++)
    29                 frame.script.getOffsetLine(i);
    30         },
    31         Error);
    33     hits++;
    34 };
    36 hits = 0;
    37 g.eval("var line = new Error().lineNumber; debugger;");

mercurial