Debian Codegraph @

js/src/jit-test/tests/debug/Frame-onPop-error-return.js

raw
1 // |jit-test| error: TestComplete
2 // onPop can change a termination into a normal return.
3
4 var g = newGlobal({newCompartment: true});
5 var dbg = new Debugger(g);
6
7 function test(type, provocation) {
8 var log;
9 var wasConstructing;
10
11 // Help people figure out which 'test' call failed.
12 print("type: " + JSON.stringify(type));
13 print("provocation: " + JSON.stringify(provocation));
14
15 dbg.onDebuggerStatement = function handleDebuggerStatement(f) {
16 log += 'd';
17 return null;
18 };
19
20 dbg.onEnterFrame = function handleEnterFrame(f) {
21 log += '(';
22 assertEq(f.type, type);
23 wasConstructing = f.constructing;
24 f.onPop = function handlePop(c) {
25 log += ')';
26 assertEq(c, null);
27 return { return: 'favor' };
28 };
29 };
30
31 log = '';
32 var result = provocation();
33 if (wasConstructing)
34 assertEq(typeof result, "object");
35 else
36 assertEq(result, 'favor');
37 assertEq(log, "(d)");
38
39 print();
40 }
41
42 g.eval("function f() { debugger; return 'termination fail'; }");
43 test("call", g.f);
44 test("call", function () { return new g.f; });
45 test("eval", function () { return g.eval("debugger; \'termination fail\';"); });
46 test("global", function () { return g.evaluate("debugger; \'termination fail\';"); });
47 throw 'TestComplete';