mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-22 01:35:35 +00:00
Bug 1406038 - Rename and enable browser_webconsole_bug_1050691_click_function_to_source.js in new console frontend; r=bgrins.
The test differs a bit from the old one since we are now testing that there is a button to jump to definition. MozReview-Commit-ID: DnC5uJ3pAea --HG-- rename : devtools/client/webconsole/new-console-output/test/mochitest/test-bug_1050691_click_function_to_source.html => devtools/client/webconsole/new-console-output/test/mochitest/test-click-function-to-source.html rename : devtools/client/webconsole/new-console-output/test/mochitest/test-bug_1050691_click_function_to_source.js => devtools/client/webconsole/new-console-output/test/mochitest/test-click-function-to-source.js extra : rebase_source : e0700658c4a88b0e16ebf8e14102dacd52aec71f
This commit is contained in:
parent
c06fd8b9d6
commit
49d939d990
@ -20,8 +20,6 @@ support-files =
|
||||
test_hsts-invalid-headers.sjs
|
||||
test-autocomplete-in-stackframe.html
|
||||
test-batching.html
|
||||
test-bug_1050691_click_function_to_source.html
|
||||
test-bug_1050691_click_function_to_source.js
|
||||
test-bug_923281_console_log_filter.html
|
||||
test-bug_923281_test1.js
|
||||
test-bug_923281_test2.js
|
||||
@ -88,6 +86,8 @@ support-files =
|
||||
test-iframe-child.html
|
||||
test-iframe-parent.html
|
||||
test-certificate-messages.html
|
||||
test-click-function-to-source.html
|
||||
test-click-function-to-source.js
|
||||
test-closure-optimized-out.html
|
||||
test-closures.html
|
||||
test-console-api-stackframe.html
|
||||
@ -237,7 +237,6 @@ tags = mcb
|
||||
[browser_webconsole_cd_iframe.js]
|
||||
[browser_webconsole_certificate_messages.js]
|
||||
[browser_webconsole_click_function_to_source.js]
|
||||
skip-if = true # Bug 1406038
|
||||
[browser_webconsole_clickable_urls.js]
|
||||
[browser_webconsole_close_unfocused_window.js]
|
||||
[browser_webconsole_closing_after_completion.js]
|
||||
|
@ -8,53 +8,37 @@
|
||||
"use strict";
|
||||
|
||||
const TEST_URI = "http://example.com/browser/devtools/client/webconsole/" +
|
||||
"test/test-bug_1050691_click_function_to_source.html";
|
||||
"new-console-output/test/mochitest/test-click-function-to-source.html";
|
||||
|
||||
// Force the old debugger UI since it's directly used (see Bug 1301705)
|
||||
Services.prefs.setBoolPref("devtools.debugger.new-debugger-frontend", false);
|
||||
registerCleanupFunction(function* () {
|
||||
Services.prefs.clearUserPref("devtools.debugger.new-debugger-frontend");
|
||||
});
|
||||
pushPref("devtools.debugger.new-debugger-frontend", false);
|
||||
|
||||
add_task(function* () {
|
||||
yield loadTab(TEST_URI);
|
||||
let hud = yield openConsole();
|
||||
add_task(async function () {
|
||||
const hud = await openNewTabAndConsole(TEST_URI);
|
||||
|
||||
// Open the Debugger panel.
|
||||
let debuggerPanel = yield openDebugger();
|
||||
// And right after come back to the Console panel.
|
||||
yield openConsole();
|
||||
yield testWithDebuggerOpen(hud, debuggerPanel);
|
||||
});
|
||||
info("Open the Debugger panel.");
|
||||
const {panel} = await openDebugger();
|
||||
let panelWin = panel.panelWin;
|
||||
|
||||
function* testWithDebuggerOpen(hud, debuggerPanel) {
|
||||
let clickable = yield printFunction(hud);
|
||||
let panelWin = debuggerPanel.panelWin;
|
||||
let onEditorLocationSet = panelWin.once(panelWin.EVENTS.EDITOR_LOCATION_SET);
|
||||
synthesizeClick(clickable, hud);
|
||||
yield onEditorLocationSet;
|
||||
ok(isDebuggerCaretPos(debuggerPanel, 7),
|
||||
"Clicking on a function should go to its source in the debugger view");
|
||||
}
|
||||
info("And right after come back to the Console panel.")
|
||||
await openConsole();
|
||||
|
||||
function synthesizeClick(clickable, hud) {
|
||||
EventUtils.synthesizeMouse(clickable, 2, 2, {}, hud.iframeWindow);
|
||||
}
|
||||
|
||||
var printFunction = Task.async(function* (hud) {
|
||||
hud.jsterm.clearOutput();
|
||||
ContentTask.spawn(gBrowser.selectedBrowser, {}, function* () {
|
||||
info("Log a function");
|
||||
const onLoggedFunction = waitForMessage(hud, "function foo")
|
||||
ContentTask.spawn(gBrowser.selectedBrowser, {}, function () {
|
||||
content.wrappedJSObject.foo();
|
||||
});
|
||||
let [result] = yield waitForMessages({
|
||||
webconsole: hud,
|
||||
messages: [{
|
||||
category: CATEGORY_WEBDEV,
|
||||
severity: SEVERITY_LOG,
|
||||
}],
|
||||
});
|
||||
let msg = [...result.matched][0];
|
||||
let clickable = msg.querySelector("a");
|
||||
ok(clickable, "clickable item for object should exist");
|
||||
return clickable;
|
||||
const {node} = await onLoggedFunction;
|
||||
const jumpIcon = node.querySelector(".jump-definition")
|
||||
ok(jumpIcon, "A jump to definition button is rendered, as expected");
|
||||
|
||||
info("Click on the jump to definition button.");
|
||||
let onEditorLocationSet = panelWin.once(panelWin.EVENTS.EDITOR_LOCATION_SET);
|
||||
jumpIcon.click();
|
||||
await onEditorLocationSet;
|
||||
|
||||
const {editor} = panelWin.DebuggerView;
|
||||
const {line, ch} = editor.getCursor();
|
||||
// Source editor starts counting line and column numbers from 0.
|
||||
ok(line === 6 && ch === 0, "Debugger is open at the expected position");
|
||||
});
|
||||
|
@ -5,7 +5,7 @@
|
||||
<title>Click on function should point to source</title>
|
||||
<!-- Any copyright is dedicated to the Public Domain.
|
||||
- http://creativecommons.org/publicdomain/zero/1.0/ -->
|
||||
<script type="text/javascript" src="test-bug_1050691_click_function_to_source.js"></script>
|
||||
<script type="text/javascript" src="test-click-function-to-source.js"></script>
|
||||
</head>
|
||||
<body></body>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user