Bug 1243958 - e10s fixes for browser_webconsole_bug_588342_document_focus.js;r=linclark
authorBrian Grinstead <bgrinstead@mozilla.com>
Mon, 07 Mar 2016 16:54:18 -0800
changeset 287032 87bc55c1a7dc02d3a9661e047095fa3beaef6862
parent 287031 8d604d4a13f3626ade10a9b8a96f8ac5bf7e4ffa
child 287033 49283c87f0e92e8cc5d93fbcae1fdb83f3448823
push id18047
push userbgrinstead@mozilla.com
push dateTue, 08 Mar 2016 02:36:40 +0000
treeherderfx-team@87bc55c1a7dc [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerslinclark
bugs1243958
milestone47.0a1
Bug 1243958 - e10s fixes for browser_webconsole_bug_588342_document_focus.js;r=linclark MozReview-Commit-ID: 6UPTfFWAFE9
devtools/client/webconsole/test/browser.ini
devtools/client/webconsole/test/browser_webconsole_bug_588342_document_focus.js
--- a/devtools/client/webconsole/test/browser.ini
+++ b/devtools/client/webconsole/test/browser.ini
@@ -207,17 +207,16 @@ tags = mcb
 [browser_webconsole_bug_583816_No_input_and_Tab_key_pressed.js]
 [browser_webconsole_bug_585237_line_limit.js]
 [browser_webconsole_bug_585956_console_trace.js]
 [browser_webconsole_bug_585991_autocomplete_keys.js]
 [browser_webconsole_bug_585991_autocomplete_popup.js]
 [browser_webconsole_bug_586388_select_all.js]
 [browser_webconsole_bug_587617_output_copy.js]
 [browser_webconsole_bug_588342_document_focus.js]
-skip-if = e10s # Bug 1042253 - webconsole tests disabled with e10s
 [browser_webconsole_bug_588730_text_node_insertion.js]
 [browser_webconsole_bug_588967_input_expansion.js]
 [browser_webconsole_bug_589162_css_filter.js]
 [browser_webconsole_bug_592442_closing_brackets.js]
 [browser_webconsole_bug_593003_iframe_wrong_hud.js]
 [browser_webconsole_bug_594497_history_arrow_keys.js]
 [browser_webconsole_bug_595223_file_uri.js]
 [browser_webconsole_bug_595350_multiple_windows_and_tabs.js]
--- a/devtools/client/webconsole/test/browser_webconsole_bug_588342_document_focus.js
+++ b/devtools/client/webconsole/test/browser_webconsole_bug_588342_document_focus.js
@@ -2,33 +2,35 @@
 /* vim: set ft=javascript ts=2 et sw=2 tw=80: */
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
 const TEST_URI = "data:text/html;charset=utf-8,Web Console test for bug 588342";
 
-var fm = Cc["@mozilla.org/focus-manager;1"].getService(Ci.nsIFocusManager);
-
 add_task(function* () {
   let { browser } = yield loadTab(TEST_URI);
+  let hud = yield openConsole();
 
-  let hud = yield openConsole();
-  yield consoleOpened(hud);
+  yield checkConsoleFocus(hud);
 
-  is(fm.focusedWindow, browser.contentWindow,
-     "content document has focus");
+  let isFocused = yield ContentTask.spawn(browser, { }, function* () {
+    var fm = Components.classes["@mozilla.org/focus-manager;1"].
+                         getService(Components.interfaces.nsIFocusManager);
+    return fm.focusedWindow == content;
+  });
 
-  fm = null;
+  ok(isFocused, "content document has focus");
 });
 
-function consoleOpened(hud) {
-  let deferred = promise.defer();
-  waitForFocus(function() {
-    is(hud.jsterm.inputNode.getAttribute("focused"), "true",
-       "jsterm input is focused on web console open");
-    isnot(fm.focusedWindow, content, "content document has no focus");
-    closeConsole(null).then(deferred.resolve);
-  }, hud.iframeWindow);
+function* checkConsoleFocus(hud) {
+  let fm = Cc["@mozilla.org/focus-manager;1"].getService(Ci.nsIFocusManager);
 
-  return deferred.promise;
+  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);
 }