Bug 1290980 - Fix intermittent e10s issue with oninstall. r=mconley, a=test-only
authorMarcos Caceres <marcos@marcosc.com>
Sun, 18 Sep 2016 21:28:00 -0400
changeset 357900 1bd1cb92289289ec7b5864fedef8432882811192
parent 357899 15db0848afb01912963ff99d7b85bbb909d43753
child 357901 ac0ae16d36c7f5e8a165e4848858d9eeb0f73df1
push id1324
push usermtabara@mozilla.com
push dateMon, 16 Jan 2017 13:07:44 +0000
treeherdermozilla-release@a01c49833940 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmconley, test-only
bugs1290980
milestone51.0a2
Bug 1290980 - Fix intermittent e10s issue with oninstall. r=mconley, a=test-only
dom/manifest/test/browser_fire_install_event.js
--- a/dom/manifest/test/browser_fire_install_event.js
+++ b/dom/manifest/test/browser_fire_install_event.js
@@ -16,26 +16,28 @@ function enableOnInstallPref() {
   };
   return SpecialPowers.pushPrefEnv(ops);
 }
 
 // Send a message for the even to be fired.
 // This cause file_reg_install_event.html to be dynamically change.
 function* theTest(aBrowser) {
   aBrowser.allowEvents = true;
-  // Resolves when we get a custom event with the correct name
-  const responsePromise = new Promise((resolve) => {
-    aBrowser.contentDocument.addEventListener("dom.manifest.oninstall", resolve);
+  let waitForInstall = ContentTask.spawn(aBrowser, null, function*() {
+    yield ContentTaskUtils.waitForEvent(content.window, "install");
   });
-  const mm = aBrowser.messageManager;
-  const msgKey = "DOM:Manifest:FireInstallEvent";
-  const { data: { success } } = yield PromiseMessage.send(mm, msgKey);
+  const { data: { success } } = yield PromiseMessage
+    .send(aBrowser.messageManager, "DOM:Manifest:FireInstallEvent");
   ok(success, "message sent and received successfully.");
-  const { detail: { result } } = yield responsePromise;
-  ok(result, "the page sent us an acknowledgment as a custom event");
+  try {
+    yield waitForInstall;
+    ok(true, "Install event fired");
+  } catch (err) {
+    ok(false, "Install event didn't fire: " + err.message);
+  }
 }
 
 // Open a tab and run the test
 add_task(function*() {
   yield enableOnInstallPref();
   let tabOptions = {
     gBrowser: gBrowser,
     url: testURL.href,