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