Update browser_bug495058.js for new world draft
authorMike Conley <mconley@mozilla.com>
Wed, 25 May 2016 15:57:57 -0400
changeset 374664 e5aecb65f3108f601691f6b5bf1491c2dbe4a063
parent 374663 892e0a1f3d5267e2a4b79bd40df24131104324da
child 374665 717b56345830a26af102658d7f69f8666b42dcbb
push id20055
push usermconley@mozilla.com
push dateThu, 02 Jun 2016 19:00:42 +0000
bugs495058
milestone49.0a1
Update browser_bug495058.js for new world MozReview-Commit-ID: 6Ktl6Dyztg3
browser/base/content/test/general/browser_bug495058.js
--- a/browser/base/content/test/general/browser_bug495058.js
+++ b/browser/base/content/test/general/browser_bug495058.js
@@ -10,30 +10,28 @@ const URIS = [
 ];
 
 add_task(function*() {
   for (let uri of URIS) {
     let tab = gBrowser.addTab();
     yield BrowserTestUtils.loadURI(tab.linkedBrowser, uri);
 
     let win = gBrowser.replaceTabWithWindow(tab);
-    yield BrowserTestUtils.waitForEvent(win, "load");
-
+    yield TestUtils.topicObserved("browser-delayed-startup-finished",
+                                  subject => subject == win);
     tab = win.gBrowser.selectedTab;
 
-    // By default, we'll wait for MozAfterPaint to come up through the
-    // browser element. We'll handle the e10s case in the next block.
-    let contentPainted = BrowserTestUtils.waitForEvent(tab.linkedBrowser,
-                                                       "MozAfterPaint");
-
-    let delayedStartup =
-      TestUtils.topicObserved("browser-delayed-startup-finished",
-                              subject => subject == win);
-
-    yield Promise.all([delayedStartup, contentPainted]);
+    // BrowserTestUtils doesn't get the add-on shims, which means that
+    // MozAfterPaint won't get shimmed over if we add an event handler
+    // for it in the parent.
+    if (tab.linkedBrowser.isRemoteBrowser) {
+      yield BrowserTestUtils.waitForContentEvent(tab.linkedBrowser, "MozAfterPaint");
+    } else {
+      yield BrowserTestUtils.waitForEvent(tab.linkedBrowser, "MozAfterPaint");
+    }
 
     Assert.equal(win.gBrowser.currentURI.spec, uri, uri + ": uri loaded in detached tab");
     Assert.equal(win.document.activeElement, win.gBrowser.selectedBrowser, uri + ": browser is focused");
     Assert.equal(win.gURLBar.value, "", uri + ": urlbar is empty");
     Assert.ok(win.gURLBar.placeholder, uri + ": placeholder text is present");
 
     yield BrowserTestUtils.closeWindow(win);
   }