Bug 1173330, fix to use content tasks and BrowserTestUtils, and reenable browser_bug638292.js, r=felipe
authorNeil Deakin <neil@mozilla.com>
Fri, 09 Oct 2015 08:50:13 -0400
changeset 300417 509dfb8dffa103a637e474fab8db61b9ea651072
parent 300416 b2e96500fbd87f0aa0b268727c5d015c77054213
child 300418 958e4293006dff60f8cb703335be335e9fc52ab6
push id5392
push userraliiev@mozilla.com
push dateMon, 14 Dec 2015 20:08:23 +0000
treeherdermozilla-beta@16ce8562a975 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfelipe
bugs1173330, 638292
milestone44.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 1173330, fix to use content tasks and BrowserTestUtils, and reenable browser_bug638292.js, r=felipe
toolkit/mozapps/extensions/test/xpinstall/browser.ini
toolkit/mozapps/extensions/test/xpinstall/browser_bug638292.js
--- a/toolkit/mozapps/extensions/test/xpinstall/browser.ini
+++ b/toolkit/mozapps/extensions/test/xpinstall/browser.ini
@@ -37,17 +37,16 @@ support-files =
 [browser_auth4.js]
 [browser_badargs.js]
 [browser_badargs2.js]
 [browser_badhash.js]
 [browser_badhashtype.js]
 [browser_bug540558.js]
 [browser_bug611242.js]
 [browser_bug638292.js]
-skip-if = e10s # Bug 1173330
 [browser_bug645699.js]
 [browser_bug672485.js]
 skip-if = true # disabled due to a leak. See bug 682410.
 [browser_cancel.js]
 [browser_concurrent_installs.js]
 [browser_cookies.js]
 [browser_cookies2.js]
 [browser_cookies3.js]
--- a/toolkit/mozapps/extensions/test/xpinstall/browser_bug638292.js
+++ b/toolkit/mozapps/extensions/test/xpinstall/browser_bug638292.js
@@ -1,63 +1,40 @@
 // ----------------------------------------------------------------------------
 // Test whether an InstallTrigger.enabled is working
-function test() {
-  waitForExplicitFinish();
+add_task(function * ()
+{
+  let testtab = yield BrowserTestUtils.openNewForegroundTab(gBrowser, TESTROOT + "bug638292.html");
 
-  gBrowser.selectedTab = gBrowser.addTab();
-  gBrowser.selectedBrowser.addEventListener("load", function() {
-    gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
-    waitForFocus(page_loaded, gBrowser.contentWindow);
-  }, true);
-  gBrowser.loadURI(TESTROOT + "bug638292.html");
-}
+  function* verify(link, button)
+  {
+    info("Clicking " + link);
 
-function check_load(aCallback) {
-  gBrowser.addEventListener("load", function(aEvent) {
-    if (!gBrowser.browsers[2] ||
-        aEvent.target != gBrowser.browsers[2].contentDocument) {
-      // SeaMonkey tabbrowser needs to deal with additional loads.
-      if (navigator.userAgent.match(/ SeaMonkey\//))
-        info("Ignoring unrelated load on SeaMonkey. (Expected 2-3 times.)");
-      else
-        ok(false, "Ignoring unrelated load on Firefox. (Should never happen!)");
-      return;
-    }
+    let waitForNewTabPromise = BrowserTestUtils.waitForNewTab(gBrowser);
 
-    gBrowser.removeEventListener("load", arguments.callee, true);
+    yield BrowserTestUtils.synthesizeMouseAtCenter("#" + link, { button: button },
+                                                   gBrowser.selectedBrowser);
 
-    // Let the load handler complete
-    executeSoon(function() {
-      var doc = gBrowser.browsers[2].contentDocument;
-      is(doc.getElementById("enabled").textContent, "true", "installTrigger should have been enabled");
+    let newtab = yield waitForNewTabPromise;
+
+    yield BrowserTestUtils.browserLoaded(newtab.linkedBrowser);
 
-      // Focus the old tab
-      gBrowser.selectedTab = gBrowser.tabs[1];
-      waitForFocus(function() {
-        // Close the new tab
-        gBrowser.removeTab(gBrowser.tabs[2]);
-        aCallback();
-      }, gBrowser.contentWindow);
+    let result = yield ContentTask.spawn(newtab.linkedBrowser, { }, function* () {
+      return (content.document.getElementById("enabled").textContent == "true");
     });
-  }, true);
-}
 
-function page_loaded() {
-  var doc = gBrowser.contentDocument;
-  info("Clicking link 1");
-  EventUtils.synthesizeMouseAtCenter(doc.getElementById("link1"), { }, gBrowser.contentWindow);
+    ok(result, "installTrigger for " + link + " should have been enabled");
 
-  check_load(function() {
-    info("Clicking link 2");
-    EventUtils.synthesizeMouseAtCenter(doc.getElementById("link2"), { }, gBrowser.contentWindow);
-
-    check_load(function() {
-      info("Clicking link 3");
-      EventUtils.synthesizeMouseAtCenter(doc.getElementById("link3"), { button: 1 }, gBrowser.contentWindow);
+    // Focus the old tab (link3 is opened in the background)
+    if (link != "link3") {
+      yield BrowserTestUtils.switchTab(gBrowser, testtab);
+    }
+    gBrowser.removeTab(newtab);
+  }
 
-      check_load(function() {
-        gBrowser.removeCurrentTab();
-        finish();
-      });
-    });
-  });
-}
+  yield* verify("link1", 0);
+  yield* verify("link2", 0);
+  yield* verify("link3", 1);
+
+  gBrowser.removeCurrentTab();
+});
+
+