Debian Codegraph @

js/src/jit-test/tests/debug/Debugger-allowUnobservedAsmJS-01.js

raw
1 load(libdir + "asm.js");
2
3 var g = newGlobal({newCompartment: true});
4 g.parent = this;
5 g.eval("dbg = new Debugger(parent);");
6
7 // Initial state is to inhibit asm.js.
8 assertEq(g.dbg.allowUnobservedAsmJS, false);
9
10 var asmFunStr = USE_ASM + 'function f() {} return f';
11
12 // With asm.js inhibited, asm.js should fail with a type error about the
13 // debugger being on.
14 assertAsmTypeFail(asmFunStr);
15
16 // With asm.js uninhibited, asm.js linking should work.
17 g.dbg.allowUnobservedAsmJS = true;
18 assertEq(asmLink(asmCompile(asmFunStr))(), undefined);
19
20 // Toggling back should inhibit again.
21 g.dbg.allowUnobservedAsmJS = false;
22 assertAsmTypeFail(asmFunStr);
23
24 // Removing the global should lift the inhibition.
25 g.dbg.removeDebuggee(this);
26 assertEq(asmLink(asmCompile(asmFunStr))(), undefined);