michael@0: /* michael@0: * Debugger.Source.prototype.text should correctly retrieve the source for michael@0: * code compiled with CompileOptions::LAZY_SOURCE. michael@0: */ michael@0: michael@0: // withSourceHook isn't defined if you pass the shell the --fuzzing-safe michael@0: // option. Skip this test silently, to avoid spurious failures. michael@0: if (typeof withSourceHook != 'function') michael@0: quit(0); michael@0: michael@0: let g = newGlobal(); michael@0: let dbg = new Debugger(g); michael@0: michael@0: function test(source) { michael@0: // To ensure that we're getting the value the source hook returns, make michael@0: // it differ from the actual source. michael@0: let frobbed = source.replace(/debugger/, 'reggubed'); michael@0: let log = ''; michael@0: michael@0: withSourceHook(function (url) { michael@0: log += 's'; michael@0: assertEq(url, "BanalBivalve.jsm"); michael@0: return frobbed; michael@0: }, () => { michael@0: dbg.onDebuggerStatement = function (frame) { michael@0: log += 'd'; michael@0: assertEq(frame.script.source.text, frobbed); michael@0: } michael@0: michael@0: g.evaluate(source, { fileName: "BanalBivalve.jsm", michael@0: sourceIsLazy: true }); michael@0: }); michael@0: michael@0: assertEq(log, 'ds'); michael@0: } michael@0: michael@0: test("debugger; // Ignominious Iguana"); michael@0: test("(function () { debugger; /* Meretricious Marmoset */})();"); michael@0: test("(() => { debugger; })(); // Gaunt Gibbon");