Bug 1416466 - Wait for the next event tick before resolving Promise for onload event in tests in security/manager/ssl/tests/mochitest/browser/. r=mossop
authorTooru Fujisawa <arai_a@mac.com>
Sat, 18 Nov 2017 22:57:18 +0900
changeset 392578 c69914a662039fc3e359f74ed1c9ba58fcef6306
parent 392577 280e6695b89da9da70db5ecc0d97aac064306d2f
child 392579 ae9e1ead6772ccc0e7d201f67cc786fe76e53bdd
push id97475
push userarai_a@mac.com
push dateSat, 18 Nov 2017 13:59:29 +0000
treeherdermozilla-inbound@ae9e1ead6772 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmossop
bugs1416466
milestone59.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 1416466 - Wait for the next event tick before resolving Promise for onload event in tests in security/manager/ssl/tests/mochitest/browser/. r=mossop
security/manager/ssl/tests/mochitest/browser/browser_clientAuth_ui.js
security/manager/ssl/tests/mochitest/browser/browser_deleteCert_ui.js
security/manager/ssl/tests/mochitest/browser/browser_downloadCert_ui.js
security/manager/ssl/tests/mochitest/browser/browser_editCACertTrust.js
security/manager/ssl/tests/mochitest/browser/browser_exportP12_passwordUI.js
security/manager/ssl/tests/mochitest/browser/browser_loadPKCS11Module_ui.js
--- a/security/manager/ssl/tests/mochitest/browser/browser_clientAuth_ui.js
+++ b/security/manager/ssl/tests/mochitest/browser/browser_clientAuth_ui.js
@@ -35,17 +35,17 @@ function openClientAuthDialog(cert) {
 
   let returnVals = Cc["@mozilla.org/hash-property-bag;1"]
                      .createInstance(Ci.nsIWritablePropertyBag2);
   let win = window.openDialog("chrome://pippki/content/clientauthask.xul", "",
                               "", TEST_HOSTNAME, TEST_ORG, TEST_ISSUER_ORG,
                               TEST_PORT, certList, returnVals);
   return new Promise((resolve, reject) => {
     win.addEventListener("load", function() {
-      resolve([win, returnVals]);
+      executeSoon(() => resolve([win, returnVals]));
     }, {once: true});
   });
 }
 
 /**
  * Checks that the contents of the given cert chooser dialog match the details
  * of build/pgo/certs/mochitest.client.
  *
--- a/security/manager/ssl/tests/mochitest/browser/browser_deleteCert_ui.js
+++ b/security/manager/ssl/tests/mochitest/browser/browser_deleteCert_ui.js
@@ -61,17 +61,17 @@ const TEST_CASES = [
 function openDeleteCertConfirmDialog(tabID) {
   let retVals = {
     deleteConfirmed: false,
   };
   let win = window.openDialog("chrome://pippki/content/deletecert.xul", "", "",
                               tabID, gCertArray, retVals);
   return new Promise((resolve, reject) => {
     win.addEventListener("load", function() {
-      resolve([win, retVals]);
+      executeSoon(() => resolve([win, retVals]));
     }, {once: true});
   });
 }
 
 add_task(async function setup() {
   for (let testCase of TEST_CASES) {
     let cert = null;
     if (testCase.certFilename) {
--- a/security/manager/ssl/tests/mochitest/browser/browser_downloadCert_ui.js
+++ b/security/manager/ssl/tests/mochitest/browser/browser_downloadCert_ui.js
@@ -45,17 +45,17 @@ const TEST_CASES = [
  */
 function openCertDownloadDialog(cert) {
   let returnVals = Cc["@mozilla.org/hash-property-bag;1"]
                      .createInstance(Ci.nsIWritablePropertyBag2);
   let win = window.openDialog("chrome://pippki/content/downloadcert.xul", "",
                               "", cert, returnVals);
   return new Promise((resolve, reject) => {
     win.addEventListener("load", function() {
-      resolve([win, returnVals]);
+      executeSoon(() => resolve([win, returnVals]));
     }, {once: true});
   });
 }
 
 // Mock implementation of nsICertificateDialogs.
 const gCertificateDialogs = {
   expectedCert: null,
   viewCertCallCount: 0,
--- a/security/manager/ssl/tests/mochitest/browser/browser_editCACertTrust.js
+++ b/security/manager/ssl/tests/mochitest/browser/browser_editCACertTrust.js
@@ -22,17 +22,17 @@ var gCert;
  *          A promise that resolves when the dialog has finished loading with
  *          the window of the opened dialog.
  */
 function openEditCertTrustDialog() {
   let win = window.openDialog("chrome://pippki/content/editcacert.xul", "", "",
                               gCert);
   return new Promise((resolve, reject) => {
     win.addEventListener("load", function() {
-      resolve(win);
+      executeSoon(() => resolve(win));
     }, {once: true});
   });
 }
 
 add_task(async function setup() {
   // Initially trust ca.pem for SSL, but not e-mail or object signing.
   gCert = await readCertificate("ca.pem", "CT,,");
   Assert.ok(gCertDB.isCertTrusted(gCert, Ci.nsIX509Cert.CA_CERT,
--- a/security/manager/ssl/tests/mochitest/browser/browser_exportP12_passwordUI.js
+++ b/security/manager/ssl/tests/mochitest/browser/browser_exportP12_passwordUI.js
@@ -65,17 +65,17 @@ const TEST_CASES = [
  */
 function openSetP12PasswordDialog() {
   let returnVals = Cc["@mozilla.org/hash-property-bag;1"]
                      .createInstance(Ci.nsIWritablePropertyBag2);
   let win = window.openDialog("chrome://pippki/content/setp12password.xul", "",
                               "", returnVals);
   return new Promise((resolve, reject) => {
     win.addEventListener("load", function() {
-      resolve([win, returnVals]);
+      executeSoon(() => resolve([win, returnVals]));
     }, {once: true});
   });
 }
 
 // Tests that the first password textbox is the element that is initially
 // focused.
 add_task(async function testFocus() {
   let [win] = await openSetP12PasswordDialog();
--- a/security/manager/ssl/tests/mochitest/browser/browser_loadPKCS11Module_ui.js
+++ b/security/manager/ssl/tests/mochitest/browser/browser_loadPKCS11Module_ui.js
@@ -117,17 +117,17 @@ function resetCallCounts() {
  * @returns {Promise}
  *          A promise that resolves when the dialog has finished loading, with
  *          the window of the opened dialog.
  */
 function openLoadModuleDialog() {
   let win = window.openDialog("chrome://pippki/content/load_device.xul", "", "");
   return new Promise(resolve => {
     win.addEventListener("load", function() {
-      resolve(win);
+      executeSoon(() => resolve(win));
     }, {once: true});
   });
 }
 
 /**
  * Presses the browse button and simulates interacting with the file picker that
  * should be triggered.
  *