~ubuntu-branches/ubuntu/saucy/mozjs17/saucy

« back to all changes in this revision

Viewing changes to js/src/jit-test/tests/debug/Script-clearBreakpoint-02.js

  • Committer: Package Import Robot
  • Author(s): Rico Tzschichholz
  • Date: 2013-05-25 12:24:23 UTC
  • Revision ID: package-import@ubuntu.com-20130525122423-zmxucrhtensw90xy
Tags: upstream-17.0.0
ImportĀ upstreamĀ versionĀ 17.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// A breakpoint cleared during dispatch does not fire.
 
2
// (Breakpoint dispatch is well-behaved even when breakpoint handlers clear other breakpoints.)
 
3
 
 
4
var g = newGlobal('new-compartment');
 
5
var dbg = Debugger(g);
 
6
var log = '';
 
7
dbg.onDebuggerStatement = function (frame) {
 
8
    var s = frame.script;
 
9
    function handler(i) {
 
10
        if (i === 1)
 
11
            return function () { log += i; s.clearBreakpoint(h[1]); s.clearBreakpoint(h[2]); };
 
12
        return function () { log += i; };
 
13
    }
 
14
    var offs = s.getLineOffsets(g.line0 + 2);
 
15
    var h = [];
 
16
    for (var i = 0; i < 4; i++) {
 
17
        h[i] = {hit: handler(i)};
 
18
        for (var j = 0; j < offs.length; j++)
 
19
            s.setBreakpoint(offs[j], h[i]);
 
20
    }
 
21
};
 
22
 
 
23
g.eval("var line0 = Error().lineNumber;\n" +
 
24
       "debugger;\n" +          // line0 + 1
 
25
       "result = 'ok';\n");     // line0 + 2
 
26
assertEq(log, '013');