Bug 1253229 - Fix and enable browser_fullscreen-window-open.js for e10s. r=gijs
authorDão Gottwald <dao@mozilla.com>
Thu, 03 Mar 2016 15:02:13 +0100
changeset 322918 3fb2c1052cc0da7e861ce958fd54267aa8e23d69
parent 322917 6f9ea75e0270ae093bf285729612dd9d960f1aa9
child 322919 35b992d5c3355bd3fbb62937a31bb57266df0897
push id5913
push userjlund@mozilla.com
push dateMon, 25 Apr 2016 16:57:49 +0000
treeherdermozilla-beta@dcaf0a6fa115 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgijs
bugs1253229
milestone47.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1253229 - Fix and enable browser_fullscreen-window-open.js for e10s. r=gijs
browser/base/content/test/general/browser.ini
browser/base/content/test/general/browser_fullscreen-window-open.js
--- a/browser/base/content/test/general/browser.ini
+++ b/browser/base/content/test/general/browser.ini
@@ -309,17 +309,17 @@ skip-if = e10s # Bug 1071623
 [browser_duplicateIDs.js]
 [browser_drag.js]
 skip-if = true # browser_drag.js is disabled, as it needs to be updated for the new behavior from bug 320638.
 [browser_favicon_change.js]
 [browser_favicon_change_not_in_document.js]
 [browser_findbarClose.js]
 [browser_focusonkeydown.js]
 [browser_fullscreen-window-open.js]
-skip-if = buildapp == 'mulet' || e10s || os == "linux" # Bug 933103 - mochitest's EventUtils.synthesizeMouse functions not e10s friendly. Linux: Intermittent failures - bug 941575.
+skip-if = buildapp == 'mulet' || os == "linux" # Linux: Intermittent failures - bug 941575.
 [browser_fxaccounts.js]
 support-files = fxa_profile_handler.sjs
 [browser_fxa_migrate.js]
 [browser_fxa_oauth.js]
 [browser_fxa_web_channel.js]
 [browser_gestureSupport.js]
 skip-if = e10s # Bug 863514 - no gesture support.
 [browser_getshortcutoruri.js]
--- a/browser/base/content/test/general/browser_fullscreen-window-open.js
+++ b/browser/base/content/test/general/browser_fullscreen-window-open.js
@@ -11,29 +11,25 @@ const TEST_FILE = "file_fullscreen-windo
 const gHttpTestRoot = getRootDirectory(gTestPath).replace("chrome://mochitests/content/",
                                                           "http://127.0.0.1:8888/");
 
 function test () {
   waitForExplicitFinish();
 
   Services.prefs.setBoolPref(PREF_DISABLE_OPEN_NEW_WINDOW, true);
 
-  let newTab = gBrowser.addTab();
+  let newTab = gBrowser.addTab(gHttpTestRoot + TEST_FILE);
   gBrowser.selectedTab = newTab;
 
-  let gTestBrowser = gBrowser.selectedBrowser;
-  gTestBrowser.addEventListener("load", function onLoad(){
-    gTestBrowser.removeEventListener("load", onLoad, true, true);
-
+  whenTabLoaded(newTab, function () {
     // Enter browser fullscreen mode.
     BrowserFullScreen();
 
     runNextTest();
-  }, true, true);
-  gTestBrowser.contentWindow.location.href = gHttpTestRoot + TEST_FILE;
+  });
 }
 
 registerCleanupFunction(function(){
   // Exit browser fullscreen mode.
   BrowserFullScreen();
 
   gBrowser.removeCurrentTab();
 
@@ -197,30 +193,27 @@ function waitForTabOpen(aOptions) {
   }
 
   info("Running test: " + message.title);
 
   let onTabOpen = function onTabOpen(aEvent) {
     gBrowser.tabContainer.removeEventListener("TabOpen", onTabOpen, true);
 
     let tab = aEvent.target;
-    tab.linkedBrowser.addEventListener("load", function onLoad(ev){
-      let browser = ev.currentTarget;
-      browser.removeEventListener("load", onLoad, true, true);
-
-      is(browser.contentWindow.document.title, message.title,
+    whenTabLoaded(tab, function () {
+      is(tab.linkedBrowser.contentTitle, message.title,
          "Opened Tab is expected: " + message.title);
 
       if (aOptions.successFn) {
         aOptions.successFn();
       }
 
       gBrowser.removeTab(tab);
       finalize();
-    }, true, true);
+    });
   }
   gBrowser.tabContainer.addEventListener("TabOpen", onTabOpen, true);
 
   let finalize = function () {
     aOptions.finalizeFn();
     info("Finished: " + message.title);
     runNextTest();
   };
@@ -235,17 +228,17 @@ function waitForTabOpen(aOptions) {
     option: message.param,
   });
 }
 
 
 function waitForWindowOpen(aOptions) {
   let start = Date.now();
   let message = aOptions.message;
-  let url = aOptions.url || getBrowserURL();
+  let url = aOptions.url || "about:blank";
 
   if (!message.title) {
     ok(false, "Can't get message.title");
     aOptions.finalizeFn();
     runNextTest();
     return;
   }
 
@@ -253,43 +246,41 @@ function waitForWindowOpen(aOptions) {
 
   let onFinalize = function () {
     aOptions.finalizeFn();
 
     info("Finished: " + message.title);
     runNextTest();
   };
 
-  let listener = new WindowListener(message.title, url, {
+  let listener = new WindowListener(message.title, getBrowserURL(), {
     onSuccess: aOptions.successFn,
     onFinalize: onFinalize,
   });
   Services.wm.addListener(listener);
 
-  const URI = aOptions.url || "about:blank";
-
   executeWindowOpenInContent({
-    uri: URI,
+    uri: url,
     title: message.title,
     option: message.param,
   });
 }
 
 function executeWindowOpenInContent(aParam) {
-  var testWindow = gBrowser.selectedBrowser.contentWindow;
-  var testElm = testWindow.document.getElementById("test");
-
-  testElm.setAttribute("data-test-param", JSON.stringify(aParam));
-  EventUtils.synthesizeMouseAtCenter(testElm, {}, testWindow);
+  ContentTask.spawn(gBrowser.selectedBrowser, JSON.stringify(aParam), function* (dataTestParam) {
+    let testElm = content.document.getElementById("test");
+    testElm.setAttribute("data-test-param", dataTestParam);
+    testElm.click();
+  });
 }
 
 function waitForWindowOpenFromChrome(aOptions) {
   let start = Date.now();
   let message = aOptions.message;
-  let url = aOptions.url || getBrowserURL();
+  let url = aOptions.url || "about:blank";
 
   if (!message.title) {
     ok(false, "Can't get message.title");
     aOptions.finalizeFn();
     runNextTest();
     return;
   }
 
@@ -297,26 +288,23 @@ function waitForWindowOpenFromChrome(aOp
 
   let onFinalize = function () {
     aOptions.finalizeFn();
 
     info("Finished: " + message.title);
     runNextTest();
   };
 
-  let listener = new WindowListener(message.title, url, {
+  let listener = new WindowListener(message.title, getBrowserURL(), {
     onSuccess: aOptions.successFn,
     onFinalize: onFinalize,
   });
   Services.wm.addListener(listener);
 
-
-  const URI = aOptions.url || "about:blank";
-
-  let testWindow = window.open(URI, message.title, message.option);
+  let testWindow = window.open(url, message.title, message.option);
 }
 
 function WindowListener(aTitle, aUrl, aCallBackObj) {
   this.test_title = aTitle;
   this.test_url = aUrl;
   this.callback_onSuccess = aCallBackObj.onSuccess;
   this.callBack_onFinalize = aCallBackObj.onFinalize;
 }