Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 /*
2 * Debugger.Source.prototype.text should correctly retrieve the source for
3 * code compiled with CompileOptions::LAZY_SOURCE.
4 */
6 // withSourceHook isn't defined if you pass the shell the --fuzzing-safe
7 // option. Skip this test silently, to avoid spurious failures.
8 if (typeof withSourceHook != 'function')
9 quit(0);
11 let g = newGlobal();
12 let dbg = new Debugger(g);
14 function test(source) {
15 // To ensure that we're getting the value the source hook returns, make
16 // it differ from the actual source.
17 let frobbed = source.replace(/debugger/, 'reggubed');
18 let log = '';
20 withSourceHook(function (url) {
21 log += 's';
22 assertEq(url, "BanalBivalve.jsm");
23 return frobbed;
24 }, () => {
25 dbg.onDebuggerStatement = function (frame) {
26 log += 'd';
27 assertEq(frame.script.source.text, frobbed);
28 }
30 g.evaluate(source, { fileName: "BanalBivalve.jsm",
31 sourceIsLazy: true });
32 });
34 assertEq(log, 'ds');
35 }
37 test("debugger; // Ignominious Iguana");
38 test("(function () { debugger; /* Meretricious Marmoset */})();");
39 test("(() => { debugger; })(); // Gaunt Gibbon");