browser/devtools/webconsole/test/browser_webconsole_bug_588342_document_focus.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /* vim:set ts=2 sw=2 sts=2 et: */
michael@0 2 /* ***** BEGIN LICENSE BLOCK *****
michael@0 3 * Any copyright is dedicated to the Public Domain.
michael@0 4 * http://creativecommons.org/publicdomain/zero/1.0/
michael@0 5 *
michael@0 6 * Contributor(s):
michael@0 7 * Mihai Șucan <mihai.sucan@gmail.com>
michael@0 8 *
michael@0 9 * ***** END LICENSE BLOCK ***** */
michael@0 10
michael@0 11 const TEST_URI = "data:text/html;charset=utf-8,Web Console test for bug 588342";
michael@0 12 let fm;
michael@0 13
michael@0 14 function test() {
michael@0 15 fm = Cc["@mozilla.org/focus-manager;1"].getService(Ci.nsIFocusManager);
michael@0 16 addTab(TEST_URI);
michael@0 17 browser.addEventListener("load", function onLoad() {
michael@0 18 browser.removeEventListener("load", onLoad, true);
michael@0 19 openConsole(null, consoleOpened);
michael@0 20 }, true);
michael@0 21 }
michael@0 22
michael@0 23 function consoleOpened(hud) {
michael@0 24 waitForFocus(function() {
michael@0 25 is(hud.jsterm.inputNode.getAttribute("focused"), "true",
michael@0 26 "jsterm input is focused on web console open");
michael@0 27 isnot(fm.focusedWindow, content, "content document has no focus");
michael@0 28 closeConsole(null, consoleClosed);
michael@0 29 }, hud.iframeWindow);
michael@0 30 }
michael@0 31
michael@0 32 function consoleClosed() {
michael@0 33 is(fm.focusedWindow, browser.contentWindow,
michael@0 34 "content document has focus");
michael@0 35
michael@0 36 fm = null;
michael@0 37 finishTest();
michael@0 38 }
michael@0 39

mercurial