diff --git a/dom/tests/browser/browser_focus_steal_from_chrome.js b/dom/tests/browser/browser_focus_steal_from_chrome.js index 708215da5d14..bc525a7def02 100644 --- a/dom/tests/browser/browser_focus_steal_from_chrome.js +++ b/dom/tests/browser/browser_focus_steal_from_chrome.js @@ -1,6 +1,10 @@ function test() { waitForExplicitFinish(); + let secMan = Components.classes["@mozilla.org/scriptsecuritymanager;1"] + .getService(Components.interfaces + .nsIScriptSecurityManager); + let fm = Components.classes["@mozilla.org/focus-manager;1"] .getService(Components.interfaces.nsIFocusManager); @@ -136,6 +140,32 @@ function test() { return; } + // XXX puts some useful information for bug 534420 + let activeWindow = fm.activeWindow; + let focusedWindow = fm.focusedWindow; + ok(activeWindow, "We're not active"); + ok(focusedWindow, "There is no focused window"); + is(activeWindow, window.top, "our window isn't active"); + let searchbar = BrowserSearch.searchBar; + let focusedElement = fm.focusedElement; + if (searchbar) { + let principal = searchbar.nodePrincipal; + ok(principal, "principal is null"); + info("search bar: tagName=" + searchbar.tagName + " id=" + searchbar.id); + ok(secMan.isSystemPrincipal(principal), "search bar isn't chrome"); + } else { + info("search bar is NULL!!"); + } + if (focusedElement) { + let principal = focusedElement.nodePrincipal; + ok(principal, "principal is null"); + info("focusedElement: tagName=" + focusedElement.tagName + + " id=" + focusedElement.id); + ok(secMan.isSystemPrincipal(principal), "focusedElement isn't chrome"); + } else { + info("focusedElement is NULL!!"); + } + // The contents shouldn't be able to steal the focus from chrome. // in foreground tab