Backed out 2 changesets (bug 1520966) for failing at mochitest/test_ext_webrequest_auth.html on a CLOSED TREE
authorGurzau Raul <rgurzau@mozilla.com>
Fri, 01 Feb 2019 23:30:55 +0200
changeset 456500 a2e4f48c810b48c3b542fb67df5606f4d9055639
parent 456499 b2a43f0c9d787e844577c8cceca94c35e8b05a5b
child 456501 e1141c015dd7be640f43805d4b97b254bb0f2cf8
push id111656
push userdvarga@mozilla.com
push dateSat, 02 Feb 2019 09:51:54 +0000
treeherdermozilla-inbound@d8cebb3b46cf [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1520966
milestone67.0a1
backs outf66aef24ffe6b0fd914d9f5f5a78aa848c63bba9
060f52cbeaf26bcf951f190132fb7ad220967234
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
Backed out 2 changesets (bug 1520966) for failing at mochitest/test_ext_webrequest_auth.html on a CLOSED TREE Backed out changeset f66aef24ffe6 (bug 1520966) Backed out changeset 060f52cbeaf2 (bug 1520966)
toolkit/components/passwordmgr/moz.build
toolkit/components/passwordmgr/test/mochitest.ini
toolkit/components/passwordmgr/test/mochitest/mochitest.ini
toolkit/components/passwordmgr/test/mochitest/test_xhr.html
toolkit/components/passwordmgr/test/mochitest/test_xml_load.html
toolkit/components/passwordmgr/test/prompt_common.js
toolkit/components/passwordmgr/test/test_xhr.html
toolkit/components/prompts/test/chromeScript.js
toolkit/components/prompts/test/prompt_common.js
--- a/toolkit/components/passwordmgr/moz.build
+++ b/toolkit/components/passwordmgr/moz.build
@@ -2,17 +2,17 @@
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 if CONFIG['MOZ_BUILD_APP'] == 'browser':
     DEFINES['MOZ_BUILD_APP_IS_BROWSER'] = True
 
-MOCHITEST_MANIFESTS += ['test/mochitest/mochitest.ini']
+MOCHITEST_MANIFESTS += ['test/mochitest.ini', 'test/mochitest/mochitest.ini']
 BROWSER_CHROME_MANIFESTS += ['test/browser/browser.ini']
 XPCSHELL_TESTS_MANIFESTS += ['test/unit/xpcshell.ini']
 
 TESTING_JS_MODULES += [
     # Make this file available from the "resource:" URI of the test environment.
     'test/browser/form_basic.html',
     'test/LoginTestUtils.jsm',
 ]
new file mode 100644
--- /dev/null
+++ b/toolkit/components/passwordmgr/test/mochitest.ini
@@ -0,0 +1,16 @@
+[DEFAULT]
+prefs =
+  signon.rememberSignons=true
+  signon.autofillForms.http=true
+  security.insecure_field_warning.contextual.enabled=false
+  network.auth.non-web-content-triggered-resources-http-auth-allow=true
+skip-if = e10s
+support-files =
+  authenticate.sjs
+  blank.html
+  formsubmit.sjs
+  prompt_common.js
+  pwmgr_common.js
+
+[test_xhr.html]
+skip-if = toolkit == 'android' # Tests desktop prompts
--- a/toolkit/components/passwordmgr/test/mochitest/mochitest.ini
+++ b/toolkit/components/passwordmgr/test/mochitest/mochitest.ini
@@ -88,14 +88,12 @@ skip-if = os == "linux" || toolkit == 'a
 skip-if = e10s || toolkit == 'android' # Tests desktop prompts. e10s: bug 1217876
 [test_prompt_promptAuth.html]
 skip-if = os == "linux" || toolkit == 'android' # Tests desktop prompts
 [test_prompt_promptAuth_proxy.html]
 skip-if = e10s || os == "linux" || toolkit == 'android' # Tests desktop prompts
 [test_recipe_login_fields.html]
 [test_username_focus.html]
 skip-if = toolkit == 'android' # android:autocomplete.
-[test_xhr.html]
-skip-if = toolkit == 'android' # Tests desktop prompts
 [test_xhr_2.html]
 [test_xml_load.html]
 skip-if = toolkit == 'android' # Tests desktop prompts
 
--- a/toolkit/components/passwordmgr/test/mochitest/test_xml_load.html
+++ b/toolkit/components/passwordmgr/test/mochitest/test_xml_load.html
@@ -109,27 +109,24 @@ add_task(async function test_backgroundT
     titleHidden: true,
     textHidden: false,
     passHidden: false,
     checkHidden: true,
     checkMsg: "",
     checked: false,
     focused: "textField",
     defButton: "button0",
-    chrome: true,
-    dialog: true,
-    chromeDependent: true,
-    isWindowModal: true,
   };
 
   let action = {
     buttonClick: "none",
   };
 
   await handlePrompt(state, action);
+  await checkPromptModal();
 
   await new Promise(resolve => {
     let focusScript = runInParent(checkWindowFocus);
     focusScript.addMessageListener("focusResult", (msg) => {
       focusScript.removeMessageListener("focusResult");
       ok(msg, "Dialog appears on the right tab");
       resolve(true);
     });
new file mode 100644
--- /dev/null
+++ b/toolkit/components/passwordmgr/test/prompt_common.js
@@ -0,0 +1,75 @@
+/**
+ * NOTE:
+ * This file is currently only being used for tests which haven't been
+ * fixed to work with e10s. Favor using the `prompt_common.js` file that
+ * is in `toolkit/components/prompts/test/` instead.
+ */
+/* eslint-disable mozilla/use-chromeutils-generateqi */
+
+var Ci = SpecialPowers.Ci;
+ok(Ci != null, "Access Ci");
+var Cc = SpecialPowers.Cc;
+ok(Cc != null, "Access Cc");
+
+var didDialog;
+
+var timer; // keep in outer scope so it's not GC'd before firing
+function startCallbackTimer() {
+  didDialog = false;
+
+  // Delay before the callback twiddles the prompt.
+  const dialogDelay = 10;
+
+  // Use a timer to invoke a callback to twiddle the authentication dialog
+  timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
+  timer.init(observer, dialogDelay, Ci.nsITimer.TYPE_ONE_SHOT);
+}
+
+
+var observer = SpecialPowers.wrapCallbackObject({
+  QueryInterface(iid) {
+    const interfaces = [Ci.nsIObserver,
+                        Ci.nsISupports, Ci.nsISupportsWeakReference];
+
+    if (!interfaces.some(function(v) {
+      return iid.equals(v);
+    })) {
+      throw SpecialPowers.Components.results.NS_ERROR_NO_INTERFACE;
+    }
+    return this;
+  },
+
+  observe(subject, topic, data) {
+    var doc = getDialogDoc();
+    if (doc) {
+      handleDialog(doc, testNum);
+    } else {
+      startCallbackTimer();
+    } // try again in a bit
+  },
+});
+
+function getDialogDoc() {
+  // Find the <browser> which contains notifyWindow, by looking
+  // through all the open windows and all the <browsers> in each.
+  // var enumerator = SpecialPowers.Services.wm.getEnumerator("navigator:browser");
+  for (let {docShell} of SpecialPowers.Services.wm.getXULWindowEnumerator(null)) {
+    var containedDocShells = docShell.getDocShellEnumerator(
+      docShell.typeChrome,
+      docShell.ENUMERATE_FORWARDS);
+    for (let childDocShell of containedDocShells) {
+      // We don't want it if it's not done loading.
+      if (childDocShell.busyFlags != Ci.nsIDocShell.BUSY_FLAGS_NONE) {
+        continue;
+      }
+      var childDoc = childDocShell.contentViewer.DOMDocument;
+
+      // ok(true, "Got window: " + childDoc.location.href);
+      if (childDoc.location.href == "chrome://global/content/commonDialog.xul") {
+        return childDoc;
+      }
+    }
+  }
+
+  return null;
+}
rename from toolkit/components/passwordmgr/test/mochitest/test_xhr.html
rename to toolkit/components/passwordmgr/test/test_xhr.html
--- a/toolkit/components/passwordmgr/test/mochitest/test_xhr.html
+++ b/toolkit/components/passwordmgr/test/test_xhr.html
@@ -1,172 +1,199 @@
 <!DOCTYPE HTML>
 <html>
 <head>
   <meta charset="utf-8">
   <title>Test for XHR prompts</title>
   <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
-  <script type="text/javascript" src="/tests/SimpleTest/AddTask.js"></script>
   <script type="text/javascript" src="pwmgr_common.js"></script>
   <script type="text/javascript" src="prompt_common.js"></script>
   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
 </head>
 <body>
 Login Manager test: XHR prompt
 <p id="display"></p>
 
 <div id="content" style="display: none">
   <iframe id="iframe"></iframe>
 </div>
 
 <pre id="test">
 <script class="testbody" type="text/javascript">
 
 /** Test for Login Manager: XHR prompts. **/
-function makeRequest(uri) {
-  return new Promise((resolve, reject) => {
-    let request = new XMLHttpRequest();
-    request.open("GET", uri, true);
-    request.addEventListener("loadend", function onLoadEnd() {
-      let result = xhrLoad(request.responseXML);
-      resolve(result);
-    });
-    request.send(null);
-  });
+var login1, login2;
+
+function initLogins() {
+  login1 = Cc["@mozilla.org/login-manager/loginInfo;1"].
+            createInstance(Ci.nsILoginInfo);
+  login2 = Cc["@mozilla.org/login-manager/loginInfo;1"].
+            createInstance(Ci.nsILoginInfo);
+
+  login1.init("http://mochi.test:8888", null, "xhr",
+              "xhruser1", "xhrpass1", "", "");
+  login2.init("http://mochi.test:8888", null, "xhr2",
+              "xhruser2", "xhrpass2", "", "");
+
+  SpecialPowers.Services.logins.addLogin(login1);
+  SpecialPowers.Services.logins.addLogin(login2);
+}
+
+function finishTest() {
+  ok(true, "finishTest removing testing logins...");
+  SpecialPowers.Services.logins.removeLogin(login1);
+  SpecialPowers.Services.logins.removeLogin(login2);
+
+  SimpleTest.finish();
 }
 
+function handleDialog(doc, testNum) {
+  ok(true, "handleDialog running for test " + testNum);
+
+  var clickOK = true;
+  var userfield = doc.getElementById("loginTextbox");
+  var passfield = doc.getElementById("password1Textbox");
+  var username = userfield.getAttribute("value");
+  var password = passfield.getAttribute("value");
+  var dialog    = doc.getElementById("commonDialog");
+
+  switch (testNum) {
+    case 1:
+      is(username, "xhruser1", "Checking provided username");
+      is(password, "xhrpass1", "Checking provided password");
+      break;
+
+    case 2:
+      is(username, "xhruser2", "Checking provided username");
+      is(password, "xhrpass2", "Checking provided password");
+
+      // Check that the dialog is modal, chrome and dependent;
+      // We can't just check window.opener because that'll be
+      // a content window, which therefore isn't exposed (it'll lie and
+      // be null).
+      var win = doc.defaultView;
+      var Ci = SpecialPowers.Ci;
+      var treeOwner = win.docShell.treeOwner;
+      treeOwner.QueryInterface(Ci.nsIInterfaceRequestor);
+      var flags = treeOwner.getInterface(Ci.nsIXULWindow).chromeFlags;
+      var wbc = treeOwner.getInterface(Ci.nsIWebBrowserChrome);
+      info("Flags: " + flags);
+      ok((flags & Ci.nsIWebBrowserChrome.CHROME_OPENAS_CHROME) != 0,
+         "Dialog should be opened as chrome");
+      ok((flags & Ci.nsIWebBrowserChrome.CHROME_OPENAS_DIALOG) != 0,
+         "Dialog should be opened as a dialog");
+      ok((flags & Ci.nsIWebBrowserChrome.CHROME_DEPENDENT) != 0,
+         "Dialog should be opened as dependent.");
+      ok(wbc.isWindowModal(), "Dialog should be modal");
+
+      // Check that the right tab is focused:
+      var browserWin = SpecialPowers.Services.wm.getMostRecentWindow("navigator:browser");
+      var spec = browserWin.gBrowser.selectedBrowser.currentURI.spec;
+      ok(spec.startsWith("http://mochi.test:8888"),
+         "Tab with remote URI (rather than about:blank) should be focused (" + spec + ")");
+
+
+      break;
+
+    default:
+      ok(false, "Uhh, unhandled switch for testNum #" + testNum);
+      break;
+  }
+
+  // Explicitly cancel the dialog and report a fail in this failure
+  // case, rather than letting the dialog get stuck due to an auth
+  // failure and having the test timeout.
+  if (!username && !password) {
+    ok(false, "No values prefilled");
+    clickOK = false;
+  }
+
+  if (clickOK) {
+    dialog.acceptDialog();
+  } else {
+    dialog.cancelDialog();
+  }
+
+  ok(true, "handleDialog done");
+  didDialog = true;
+}
+
+var newWin;
 function xhrLoad(xmlDoc) {
+  ok(true, "xhrLoad running for test " + testNum);
+
   // The server echos back the user/pass it received.
   var username = xmlDoc.getElementById("user").textContent;
   var password = xmlDoc.getElementById("pass").textContent;
   var authok = xmlDoc.getElementById("ok").textContent;
-  return {username, password, authok};
+
+
+  switch (testNum) {
+    case 1:
+      is(username, "xhruser1", "Checking provided username");
+      is(password, "xhrpass1", "Checking provided password");
+      break;
+
+    case 2:
+      is(username, "xhruser2", "Checking provided username");
+      is(password, "xhrpass2", "Checking provided password");
+
+      newWin.close();
+      break;
+
+    default:
+      ok(false, "Uhh, unhandled switch for testNum #" + testNum);
+      break;
+  }
+
+  doTest();
 }
 
-// Force parent to not look for tab-modal prompts, as they're not used for auth prompts.
-isTabModal = false;
-
-let prompterParent = runInParent(() => {
-  const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
-  const promptFac = Cc["@mozilla.org/passwordmanager/authpromptfactory;1"].
-                    getService(Ci.nsIPromptFactory);
-
-  let chromeWin = Services.wm.getMostRecentWindow("navigator:browser");
-  let prompt = promptFac.getPrompt(chromeWin, Ci.nsIAuthPrompt);
-
-  addMessageListener("proxyPrompter", function onMessage(msg) {
-    let rv = prompt[msg.methodName](...msg.args);
-    return {
-      rv,
-      // Send the args back to content so out/inout args can be checked.
-      args: msg.args,
-    };
-  });
-});
-
-let prompter1 = new PrompterProxy(prompterParent);
+function doTest() {
+  switch (++testNum) {
+    case 1:
+      startCallbackTimer();
+      makeRequest("authenticate.sjs?user=xhruser1&pass=xhrpass1&realm=xhr");
+      break;
 
-add_task(function setup() {
-  runInParent(function initLogins() {
-    const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
-    let nsLoginInfo = Components.Constructor("@mozilla.org/login-manager/loginInfo;1",
-                                             Ci.nsILoginInfo, "init");
-    let login1 = new nsLoginInfo("http://mochi.test:8888", null, "xhr",
-                                 "xhruser1", "xhrpass1", "", "");
-    let login2 = new nsLoginInfo("http://mochi.test:8888", null, "xhr2",
-                                 "xhruser2", "xhrpass2", "", "");
-
-    try {
-      Services.logins.addLogin(login1);
-      Services.logins.addLogin(login2);
-    } catch (e) {
-      assert.ok(false, "addLogin threw: " + e);
-    }
-  });
-});
+    case 2:
+      // Test correct parenting, by opening another tab in the foreground,
+      // and making sure the prompt re-focuses the original tab when shown:
+      newWin = window.open();
+      newWin.focus();
+      startCallbackTimer();
+      makeRequest("authenticate.sjs?user=xhruser2&pass=xhrpass2&realm=xhr2");
+      break;
 
-add_task(async function test1() {
-  let state = {
-    msg: "http://mochi.test:8888 is requesting your username and password. The site says: “xhr”",
-    title: "Authentication Required",
-    textValue: "xhruser1",
-    passValue: "xhrpass1",
-    iconClass: "authentication-icon question-icon",
-    titleHidden: true,
-    textHidden: false,
-    passHidden: false,
-    checkHidden: true,
-    checkMsg: "",
-    checked: false,
-    focused: "textField",
-    defButton: "button0",
-  };
-  let action = {
-    buttonClick: "ok",
+    default:
+      finishTest();
+  }
+}
+
+function makeRequest(uri) {
+  var request = new XMLHttpRequest();
+  request.open("GET", uri, true);
+  request.onreadystatechange = function() {
+    if (request.readyState == 4) {
+      xhrLoad(request.responseXML);
+    }
   };
-  let promptDone = handlePrompt(state, action);
-  let requestPromise = makeRequest("authenticate.sjs?user=xhruser1&pass=xhrpass1&realm=xhr");
-  await promptDone;
-  let result = await requestPromise;
+  request.send(null);
+}
 
-  is(result.authok, "PASS", "Checking for successful authentication");
-  is(result.username, "xhruser1", "Checking for username");
-  is(result.password, "xhrpass1", "Checking for password");
-});
 
-add_task(async function test2() {
-  // Test correct parenting, by opening another tab in the foreground,
-  // and making sure the prompt re-focuses the original tab when shown:
-  newWin = window.open();
-  newWin.focus();
+initLogins();
 
-  let state = {
-    msg: "http://mochi.test:8888 is requesting your username and password. The site says: “xhr2”",
-    title: "Authentication Required",
-    textValue: "xhruser2",
-    passValue: "xhrpass2",
-    iconClass: "authentication-icon question-icon",
-    titleHidden: true,
-    textHidden: false,
-    passHidden: false,
-    checkHidden: true,
-    checkMsg: "",
-    checked: false,
-    focused: "textField",
-    defButton: "button0",
-    // Check that the dialog is modal, chrome and dependent;
-    // We can't just check window.opener because that'll be
-    // a content window, which therefore isn't exposed (it'll lie and
-    // be null).
-    chrome: true,
-    dialog: true,
-    chromeDependent: true,
-    isWindowModal: true,
-  };
-  let action = {
-    buttonClick: "ok",
-  };
-  let promptDone = handlePrompt(state, action);
-  let requestPromise = makeRequest("authenticate.sjs?user=xhruser2&pass=xhrpass2&realm=xhr2");
-  await promptDone;
-  let result = await requestPromise;
+// clear plain HTTP auth sessions before the test, to allow
+// running them more than once.
+var authMgr = SpecialPowers.Cc["@mozilla.org/network/http-auth-manager;1"]
+                        .getService(SpecialPowers.Ci.nsIHttpAuthManager);
+authMgr.clearAll();
 
-  runInParent(() => {
-    const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
+// start the tests
+testNum = 0;
+doTest();
 
-    // Check that the right tab is focused:
-    let browserWin = Services.wm.getMostRecentWindow("navigator:browser");
-    let spec = browserWin.gBrowser.selectedBrowser.currentURI.spec;
-    assert.ok(spec.startsWith("http://mochi.test:8888"),
-              `Tab with remote URI (rather than about:blank)
-               should be focused (${spec})`);
-  });
-
-  is(result.authok, "PASS", "Checking for successful authentication");
-  is(result.username, "xhruser2", "Checking for username");
-  is(result.password, "xhrpass2", "Checking for password");
-
-  newWin.close();
-});
+SimpleTest.waitForExplicitFinish();
 </script>
 </pre>
 </body>
 </html>
--- a/toolkit/components/prompts/test/chromeScript.js
+++ b/toolkit/components/prompts/test/chromeScript.js
@@ -20,16 +20,40 @@ addMessageListener("handlePrompt", msg =
 function handlePromptWhenItAppears(action, isTabModal, isSelect) {
   let interval = setInterval(() => {
     if (handlePrompt(action, isTabModal, isSelect)) {
       clearInterval(interval);
     }
   }, 100);
 }
 
+addMessageListener("checkPromptModal", () => {
+  checkPromptIsModal();
+});
+
+function checkPromptIsModal() {
+  // Check that the dialog is modal, chrome and dependent;
+  // We can't just check window.opener because that'll be
+  // a content window, which therefore isn't exposed (it'll lie and
+  // be null).
+  let result = {};
+  let doc = getDialogDoc();
+  let win = doc.defaultView;
+  let treeOwner = win.docShell.treeOwner;
+  treeOwner.QueryInterface(Ci.nsIInterfaceRequestor);
+  let flags = treeOwner.getInterface(Ci.nsIXULWindow).chromeFlags;
+  let wbc = treeOwner.getInterface(Ci.nsIWebBrowserChrome);
+  result.chrome = (flags & Ci.nsIWebBrowserChrome.CHROME_OPENAS_CHROME) != 0;
+  result.dialog = (flags & Ci.nsIWebBrowserChrome.CHROME_OPENAS_DIALOG) != 0;
+  result.chromeDependent = (flags & Ci.nsIWebBrowserChrome.CHROME_DEPENDENT) != 0;
+  result.isWindowModal = wbc.isWindowModal();
+
+  sendAsyncMessage("checkPromptModalResult", result);
+}
+
 function handlePrompt(action, isTabModal, isSelect) {
   let ui;
 
   if (isTabModal) {
     let browserWin = Services.wm.getMostRecentWindow("navigator:browser");
     let gBrowser = browserWin.gBrowser;
     let promptManager = gBrowser.getTabModalPromptBox(gBrowser.selectedBrowser);
     let prompts = promptManager.listPrompts();
@@ -123,32 +147,16 @@ function getPromptState(ui) {
   } else if (e.isSameNode(ui.password1Textbox.inputField)) {
     state.focused = "passField";
   } else if (ui.infoBody.isSameNode(e)) {
     state.focused = "infoBody";
   } else {
     state.focused = "ERROR: unexpected element focused: " + (e ? e.localName : "<null>");
   }
 
-  let treeOwner = ui.prompt &&
-                  ui.prompt.docShell &&
-                  ui.prompt.docShell.treeOwner;
-  if (treeOwner && treeOwner.QueryInterface(Ci.nsIInterfaceRequestor)) {
-    // Check that the dialog is modal, chrome and dependent;
-    // We can't just check window.opener because that'll be
-    // a content window, which therefore isn't exposed (it'll lie and
-    // be null).
-    let flags = treeOwner.getInterface(Ci.nsIXULWindow).chromeFlags;
-    state.chrome = (flags & Ci.nsIWebBrowserChrome.CHROME_OPENAS_CHROME) != 0;
-    state.dialog = (flags & Ci.nsIWebBrowserChrome.CHROME_OPENAS_DIALOG) != 0;
-    state.chromeDependent = (flags & Ci.nsIWebBrowserChrome.CHROME_DEPENDENT) != 0;
-    let wbc = treeOwner.getInterface(Ci.nsIWebBrowserChrome);
-    state.isWindowModal = wbc.isWindowModal();
-  }
-
   return state;
 }
 
 function dismissSelect(ui, action) {
   let dialog = ui.getElementsByTagName("dialog")[0];
   let listbox = ui.getElementById("list");
 
   if (action.selectItem) {
--- a/toolkit/components/prompts/test/prompt_common.js
+++ b/toolkit/components/prompts/test/prompt_common.js
@@ -30,16 +30,30 @@ function handlePrompt(state, action) {
       gChromeScript.removeMessageListener("promptHandled", handled);
       checkPromptState(msg.promptState, state);
       resolve(true);
     });
     gChromeScript.sendAsyncMessage("handlePrompt", { action, isTabModal});
   });
 }
 
+function checkPromptModal() {
+  return new Promise(resolve => {
+    gChromeScript.addMessageListener("checkPromptModalResult", function handled(result) {
+      gChromeScript.removeMessageListener("checkPromptModalResult", handled);
+      ok(result.chrome, "Dialog should be opened as chrome");
+      ok(result.dialog, "Dialog should be a dialog");
+      ok(result.chromeDependent, "Dialog should be chrome dependent");
+      ok(result.isWindowModal, "Dialog should be a window modal");
+      resolve(true);
+    });
+    gChromeScript.sendAsyncMessage("checkPromptModal");
+  });
+}
+
 function checkPromptState(promptState, expectedState) {
     info(`checkPromptState: ${expectedState.msg}`);
     // XXX check title? OS X has title in content
     is(promptState.msg, expectedState.msg, "Checking expected message");
     if (isOSX && !isTabModal)
       ok(!promptState.titleHidden, "Checking title always visible on OS X");
     else
       is(promptState.titleHidden, expectedState.titleHidden, "Checking title visibility");
@@ -73,29 +87,16 @@ function checkPromptState(promptState, e
     is(promptState.defButton1, expectedState.defButton == "button1", "checking button1 default");
     is(promptState.defButton2, expectedState.defButton == "button2", "checking button2 default");
 
     if (isOSX && expectedState.focused && expectedState.focused.startsWith("button")) {
         is(promptState.focused, "infoBody", "buttons don't focus on OS X, but infoBody does instead");
     } else {
         is(promptState.focused, expectedState.focused, "Checking focused element");
     }
-
-    if (expectedState.hasOwnProperty("chrome")) {
-        is(promptState.chrome, expectedState.chrome, "Dialog should be opened as chrome");
-    }
-    if (expectedState.hasOwnProperty("dialog")) {
-        is(promptState.dialog, expectedState.dialog, "Dialog should be opened as a dialog");
-    }
-    if (expectedState.hasOwnProperty("chromeDependent")) {
-        is(promptState.chromeDependent, expectedState.chromeDependent, "Dialog should be opened as dependent");
-    }
-    if (expectedState.hasOwnProperty("isWindowModal")) {
-        is(promptState.isWindowModal, expectedState.isWindowModal, "Dialog should be modal");
-    }
 }
 
 function checkEchoedAuthInfo(expectedState, doc) {
     // The server echos back the HTTP auth info it received.
     let username = doc.getElementById("user").textContent;
     let password = doc.getElementById("pass").textContent;
     let authok = doc.getElementById("ok").textContent;