browser/devtools/webconsole/test/browser_webconsole_bug_588342_document_focus.js

Thu, 15 Jan 2015 21:03:48 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 21:03:48 +0100
branch
TOR_BUG_9701
changeset 11
deefc01c0e14
permissions
-rw-r--r--

Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)

     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 ***** */
    11 const TEST_URI = "data:text/html;charset=utf-8,Web Console test for bug 588342";
    12 let fm;
    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 }
    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 }
    32 function consoleClosed() {
    33   is(fm.focusedWindow, browser.contentWindow,
    34      "content document has focus");
    36   fm = null;
    37   finishTest();
    38 }

mercurial