1
// |jit-test| error: TestComplete
2
// onPop can change a normal return into a throw.
4
load(libdir + "asserts.js");
5
var g = newGlobal('new-compartment');
6
var dbg = new Debugger(g);
8
function test(type, provocation) {
11
// Help people figure out which 'test' call failed.
12
print("type: " + uneval(type));
13
print("provocation: " + uneval(provocation));
15
dbg.onDebuggerStatement = function handleDebuggerStatement(f) {
19
dbg.onEnterFrame = function handleEnterFrame(f) {
21
assertEq(f.type, type);
22
f.onPop = function handlePop(c) {
24
assertEq(c.return, 'compliment');
25
return { throw: 'snow' };
30
assertThrowsValue(provocation, 'snow');
36
g.eval("function f() { debugger; return 'compliment'; }");
38
test("call", function () { return new g.f; });
39
test("eval", function () { return g.eval("debugger; \'compliment\';"); });
40
test("global", function () { return g.evaluate("debugger; \'compliment\';"); });