зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1166844 - treat eval'ed code from the console as unnamed eval sources r=ejpbruel
This commit is contained in:
Родитель
24aff4397c
Коммит
487722b664
|
@ -202,6 +202,8 @@ skip-if = e10s && debug
|
|||
skip-if = e10s && debug
|
||||
[browser_dbg_conditional-breakpoints-05.js]
|
||||
skip-if = e10s && debug
|
||||
[browser_dbg_console-eval.js]
|
||||
skip-if = e10s && debug
|
||||
[browser_dbg_server-conditional-bp-01.js]
|
||||
skip-if = e10s && debug
|
||||
[browser_dbg_server-conditional-bp-02.js]
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
/**
|
||||
* Breaking in the middle of a script evaluated by the console should
|
||||
* work
|
||||
*/
|
||||
|
||||
function test() {
|
||||
Task.spawn(runTests);
|
||||
}
|
||||
|
||||
function* runTests() {
|
||||
let TAB_URL = EXAMPLE_URL + "doc_empty-tab-01.html";
|
||||
let [,, panel] = yield initDebugger(TAB_URL);
|
||||
let dbgWin = panel.panelWin;
|
||||
let sources = dbgWin.DebuggerView.Sources;
|
||||
let frames = dbgWin.DebuggerView.StackFrames;
|
||||
let editor = dbgWin.DebuggerView.editor;
|
||||
let toolbox = gDevTools.getToolbox(panel.target);
|
||||
|
||||
let paused = promise.all([
|
||||
waitForEditorEvents(panel, "cursorActivity"),
|
||||
waitForDebuggerEvents(panel, dbgWin.EVENTS.SOURCE_SHOWN)
|
||||
]);
|
||||
|
||||
toolbox.once("webconsole-ready", () => {
|
||||
ok(toolbox.splitConsole, "Split console is shown.");
|
||||
let jsterm = toolbox.getPanel("webconsole").hud.jsterm;
|
||||
jsterm.execute('debugger');
|
||||
});
|
||||
EventUtils.synthesizeKey("VK_ESCAPE", {}, dbgWin);
|
||||
|
||||
yield paused;
|
||||
is(sources.selectedItem.attachment.label, 'SCRIPT0',
|
||||
'Anonymous source is selected in sources');
|
||||
dump('text ::' + editor.getText() + '::\n');
|
||||
ok(editor.getText() === 'debugger', 'Editor has correct text');
|
||||
|
||||
yield toolbox.closeSplitConsole();
|
||||
yield resumeDebuggerThenCloseAndFinish(panel);
|
||||
}
|
|
@ -5407,6 +5407,10 @@ function getSourceURL(source) {
|
|||
|
||||
return source.displayURL;
|
||||
}
|
||||
else if(source.url === 'debugger eval code') {
|
||||
// Treat code evaluated by the console as unnamed eval scripts
|
||||
return null;
|
||||
}
|
||||
return source.url;
|
||||
}
|
||||
exports.getSourceURL = getSourceURL;
|
||||
|
|
|
@ -296,11 +296,9 @@ TabSources.prototype = {
|
|||
spec.contentType = "text/javascript";
|
||||
}
|
||||
} catch(ex) {
|
||||
// Not a valid URI.
|
||||
|
||||
// bug 1124536: fix getSourceText on scripts associated "javascript:SOURCE" urls
|
||||
// (e.g. 'evaluate(sandbox, sourcecode, "javascript:"+sourcecode)' )
|
||||
if (url.indexOf("javascript:") === 0) {
|
||||
// There are a few special URLs that we know are JavaScript:
|
||||
// inline `javascript:` and code coming from the console
|
||||
if (url.indexOf("javascript:") === 0 || url === 'debugger eval code') {
|
||||
spec.contentType = "text/javascript";
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче