Bug 1404368 - Enable browser_webconsole_document_focus.js in new frontend;r=jdescottes.

MozReview-Commit-ID: Fd9p0oigRpB

--HG--
extra : rebase_source : 8a3eb4701abaf310c6347ffbedc2a20552ed844c
This commit is contained in:
Nicolas Chevobbe 2018-01-04 12:35:06 +01:00
Родитель 17b0c62378
Коммит 4813426592
2 изменённых файлов: 13 добавлений и 28 удалений

Просмотреть файл

@ -264,7 +264,6 @@ subsuite = clipboard
skip-if = (e10s && debug) || (e10s && os == 'win') # Bug 1221499 enabled these on windows skip-if = (e10s && debug) || (e10s && os == 'win') # Bug 1221499 enabled these on windows
[browser_webconsole_cspro.js] [browser_webconsole_cspro.js]
[browser_webconsole_document_focus.js] [browser_webconsole_document_focus.js]
skip-if = true # Bug 1404368
[browser_webconsole_duplicate_errors.js] [browser_webconsole_duplicate_errors.js]
skip-if = true # Bug 1403907 skip-if = true # Bug 1403907
[browser_webconsole_errors_after_page_reload.js] [browser_webconsole_errors_after_page_reload.js]

Просмотреть файл

@ -1,38 +1,24 @@
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
/* Any copyright is dedicated to the Public Domain. /* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */ * http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict"; "use strict";
// See Bug 588342. // Check that focus is restored to content page after closing the console. See Bug 588342.
const TEST_URI = "data:text/html;charset=utf-8,Test content focus after closing console";
const TEST_URI = "data:text/html;charset=utf-8,Web Console test for bug 588342"; add_task(async function () {
let hud = await openNewTabAndConsole(TEST_URI);
add_task(function* () { let inputNode = hud.jsterm.inputNode;
let { browser } = yield loadTab(TEST_URI); info("Focus after console is opened");
let hud = yield openConsole(); ok(hasFocus(inputNode), "input node is focused after console is opened");
yield checkConsoleFocus(hud); info("Closing console");
await closeConsole();
let isFocused = yield ContentTask.spawn(browser, { }, function* () { const isFocused = await ContentTask.spawn(gBrowser.selectedBrowser, { }, function () {
var fm = Components.classes["@mozilla.org/focus-manager;1"]. const cmp = "@mozilla.org/focus-manager;1";
getService(Components.interfaces.nsIFocusManager); const fm = Components.classes[cmp].getService(Components.interfaces.nsIFocusManager);
return fm.focusedWindow == content; return fm.focusedWindow == content;
}); });
ok(isFocused, "content document has focus after closing the console");
ok(isFocused, "content document has focus");
}); });
function* checkConsoleFocus(hud) {
let fm = Cc["@mozilla.org/focus-manager;1"].getService(Ci.nsIFocusManager);
yield new Promise(resolve => {
waitForFocus(resolve);
});
is(hud.jsterm.inputNode.getAttribute("focused"), "true",
"jsterm input is focused on web console open");
is(fm.focusedWindow, hud.iframeWindow, "hud window is focused");
yield closeConsole(null);
}