Bug 1265194 - Refactor prompt tests to use state/action objects and new common helpers. r=adw

MozReview-Commit-ID: FviWeWkJjTA

--HG--
extra : rebase_source : 23f8a9b1913d255f9eed11244b96a78d4e3ad39d
This commit is contained in:
Justin Dolske 2016-04-16 16:06:41 -07:00
parent 6cf0c18e09
commit ab6f95c610
8 changed files with 342 additions and 304 deletions

View File

@ -81,6 +81,7 @@ function getSelectState(ui) {
function getPromptState(ui) {
let state = {};
state.msg = ui.infoBody.textContent;
state.titleHidden = ui.infoTitle.getAttribute("hidden") == "true";
state.textHidden = ui.loginContainer.hidden;
state.passHidden = ui.password1Container.hidden;
state.checkHidden = ui.checkboxContainer.hidden;
@ -174,6 +175,11 @@ function dismissPrompt(ui, action) {
case 2:
ui.button2.click();
break;
case "ESC":
// XXX This is assuming tab-modal.
let browserWin = Services.wm.getMostRecentWindow("navigator:browser");
EventUtils.synthesizeKey("KEY_Escape", { code: "Escape" }, browserWin);
break;
case "pollOK":
// Buttons are disabled at the moment, poll until they're reenabled.
// Can't use setInterval here, because the window's in a modal state
@ -191,39 +197,6 @@ function dismissPrompt(ui, action) {
}
}
addMessageListener("cancelPrompt", message => {
cancelPromptWhenItAppears();
});
function cancelPromptWhenItAppears() {
let interval = setInterval(() => {
if (cancelPrompt()) {
clearInterval(interval);
}
}, 100);
}
function cancelPrompt() {
let browserWin = Services.wm.getMostRecentWindow("navigator:browser");
let gBrowser = browserWin.gBrowser;
let promptManager = gBrowser.getTabModalPromptBox(gBrowser.selectedBrowser);
let prompts = promptManager.listPrompts();
if (!prompts.length) {
return false;
}
sendAsyncMessage("promptCanceled", {
ui: {
infoTitle: {
hidden: prompts[0].ui.infoTitle.getAttribute("hidden") == "true",
},
},
});
EventUtils.synthesizeKey("KEY_Escape", { code: "Escape" }, browserWin);
return true;
}
function getDialogDoc() {
// Trudge through all the open windows, until we find the one
// that has either commonDialog.xul or selectDialog.xul loaded.

View File

@ -3,132 +3,21 @@ const Cc = SpecialPowers.Cc;
ok(Ci != null, "Access Ci");
ok(Cc != null, "Access Cc");
var didDialog;
var isSelectDialog = false;
var isTabModal = false;
if (SpecialPowers.getBoolPref("prompts.tab_modal.enabled")) {
isTabModal = true;
}
var usePromptService = true;
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 = {
QueryInterface : SpecialPowers.wrapCallback(function (iid) {
const interfaces = [Ci.nsIObserver,
Ci.nsISupports, Ci.nsISupportsWeakReference];
if (!interfaces.some( function(v) { return iid.equals(v) } ))
throw SpecialPowers.Cr.NS_ERROR_NO_INTERFACE;
return this;
}),
observe : SpecialPowers.wrapCallback(function (subject, topic, data) {
try {
if (isTabModal) {
var promptBox = getTabModalPromptBox(window);
ok(promptBox, "got tabmodal promptbox");
var prompts = SpecialPowers.wrap(promptBox).listPrompts();
if (prompts.length)
handleDialog(prompts[0].Dialog.ui, testNum);
else
startCallbackTimer(); // try again in a bit
} else {
var doc = getDialogDoc();
if (isSelectDialog && doc)
handleDialog(doc, testNum);
else if (doc)
handleDialog(doc.defaultView.Dialog.ui, testNum);
else
startCallbackTimer(); // try again in a bit
}
} catch (e) {
ok(false, "Exception thrown in the timer callback: " + e + " at " + (e.fileName || e.filename) + ":" + (e.lineNumber || e.linenumber));
}
})
};
function getTabModalPromptBox(domWin) {
var promptBox = null;
// Given a content DOM window, returns the chrome window it's in.
function getChromeWindow(aWindow) {
var chromeWin = SpecialPowers.wrap(aWindow).QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebNavigation)
.QueryInterface(Ci.nsIDocShell)
.chromeEventHandler.ownerDocument.defaultView;
return chromeWin;
}
try {
// Get the topmost window, in case we're in a frame.
var promptWin = domWin.top;
// Get the chrome window for the content window we're using.
var chromeWin = getChromeWindow(promptWin);
if (chromeWin.getTabModalPromptBox)
promptBox = chromeWin.getTabModalPromptBox(promptWin);
} catch (e) {
// If any errors happen, just assume no tabmodal prompter.
}
// Callers get confused by a wrapped promptBox here.
return SpecialPowers.unwrap(promptBox);
}
function getDialogDoc() {
// Trudge through all the open windows, until we find the one
// that has either commonDialog.xul or selectDialog.xul loaded.
var wm = Cc["@mozilla.org/appshell/window-mediator;1"].
getService(Ci.nsIWindowMediator);
//var enumerator = wm.getEnumerator("navigator:browser");
var enumerator = wm.getXULWindowEnumerator(null);
while (enumerator.hasMoreElements()) {
var win = enumerator.getNext();
var windowDocShell = win.QueryInterface(Ci.nsIXULWindow).docShell;
var containedDocShells = windowDocShell.getDocShellEnumerator(
Ci.nsIDocShellTreeItem.typeChrome,
Ci.nsIDocShell.ENUMERATE_FORWARDS);
while (containedDocShells.hasMoreElements()) {
// Get the corresponding document for this docshell
var childDocShell = containedDocShells.getNext();
// We don't want it if it's not done loading.
if (childDocShell.busyFlags != Ci.nsIDocShell.BUSY_FLAGS_NONE)
continue;
var childDoc = childDocShell.QueryInterface(Ci.nsIDocShell)
.contentViewer
.DOMDocument;
//ok(true, "Got window: " + childDoc.location.href);
if (childDoc.location.href == "chrome://global/content/commonDialog.xul")
return childDoc;
if (childDoc.location.href == "chrome://global/content/selectDialog.xul")
return childDoc;
}
}
return null;
}
var isOSX = ("nsILocalFileMac" in SpecialPowers.Ci);
var isLinux = ("@mozilla.org/gnome-gconf-service;1" in SpecialPowers.Cc);
var isE10S = SpecialPowers.Services.appinfo.processType == 2;
var gChromeScript = SpecialPowers.loadChromeScript(SimpleTest.getTestFileURL("chromeScript.js"));
SimpleTest.registerCleanupFunction(() => gChromeScript.destroy());
function handlePrompt() {
return new Promise(resolve => {
gChromeScript.addMessageListener("promptHandled", function handled(msg) {
@ -143,6 +32,10 @@ function handlePrompt() {
function checkPromptState(promptState, expectedState) {
// 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");
is(promptState.textHidden, expectedState.textHidden, "Checking textbox visibility");
is(promptState.passHidden, expectedState.passHidden, "Checking passbox visibility");
is(promptState.checkHidden, expectedState.checkHidden, "Checking checkbox visibility");

View File

@ -8,50 +8,67 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=619644
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
<script type="text/javascript" src="prompt_common.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=619644">Mozilla Bug 619644</a>
<pre id="test">
<script class="testbody" type="text/javascript">
function hasTabModalPrompts() {
var prefName = "prompts.tab_modal.enabled";
Services = SpecialPowers.Services;
return Services.prefs.getPrefType(prefName) == Services.prefs.PREF_BOOL &&
Services.prefs.getBoolPref(prefName);
}
if (!hasTabModalPrompts()) {
todo(false, "Test disabled when tab modal prompts are not enabled.");
} else {
SimpleTest.waitForExplicitFinish();
// This is a little yucky, but it works
// The contents of bug619644_inner.html
const expectedFinalDoc =
"<head><\/head><body><p>Original content<\/p>\n<script>\n window.opener.postMessage(\"\", \"*\");\n confirm (\"Message\");\n document.write (\"Extra content\");\n window.opener.postMessage(document.documentElement.innerHTML, \"*\");\n<\/script>Extra content<\/body>";
let gChromeMessageManager;
if (!isTabModal) {
todo(false, "Test disabled when tab modal prompts are not enabled.");
} else {
inittest();
}
function runtest(e)
{
var promptDone;
function inittest() {
window.addEventListener("message", runtest, false);
window.open("bug619644_inner.html", "619644");
SimpleTest.waitForExplicitFinish();
}
function runtest(e) {
window.removeEventListener("message", runtest, false);
window.addEventListener("message", checktest, false);
let url = SimpleTest.getTestFileURL("chromeScript.js");
gChromeMessageManager = SpecialPowers.loadChromeScript(url);
gChromeMessageManager.sendAsyncMessage("cancelPrompt");
state = {
msg : "Message",
iconClass : "question-icon",
titleHidden : true,
textHidden : true,
passHidden : true,
checkHidden : true,
textValue : "",
passValue : "",
checkMsg : "",
checked : false,
focused : "button0",
defButton : "button0",
};
action = {
buttonClick: "ESC",
};
promptDone = handlePrompt(action);
}
function checktest(e) {
is(e.data, expectedFinalDoc, "ESC press should not abort document load");
e.source.close();
gChromeMessageManager.destroy();
SimpleTest.finish();
promptDone.then(endtest);
}
window.addEventListener("message", runtest, false);
window.open("bug619644_inner.html", "619644");
function endtest() {
info("Ending test");
SimpleTest.finish();
}
</script>
</pre>

View File

@ -3,10 +3,12 @@
<title>Test for Bug 620145</title>
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SpawnTask.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
<script type="text/javascript" src="prompt_common.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body onload="runtest()">
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=620145">Mozilla Bug 620145</a>
<pre id="test">
</pre>
@ -22,64 +24,60 @@
<button id="button" onmouseup="openAlert()">Button</button>
<script class="testbody" type="text/javascript">
SimpleTest.waitForExplicitFinish();
var selectionTest = false;
var testNum = 0;
function hasTabModalPrompts() {
var prefName = "prompts.tab_modal.enabled";
var Services = SpecialPowers.Cu
.import("resource://gre/modules/Services.jsm")
.Services;
return Services.prefs.getPrefType(prefName) == Services.prefs.PREF_BOOL &&
Services.prefs.getBoolPref(prefName);
}
var state, action;
function openAlert() {
ok(true, "opening alert...");
info("opening alert...");
alert("hello!");
ok(true, "...alert done.");
info("...alert done.");
}
function runtest()
{
add_task(function* runTest() {
// The <button> in this test's HTML opens a prompt when clicked.
// Here we send the events to simulate clicking it.
ok(true, "starting test");
isTabModal = hasTabModalPrompts();
if (!isTabModal)
todo(false, "Test is run with tab modal prompts disabled.");
else
ok(true, "Test is run with tab modal prompts enabled.");
info("isTabModal? " + isTabModal);
selectionTest = isTabModal;
let url = SimpleTest.getTestFileURL("chromeScript.js");
let chrome = SpecialPowers.loadChromeScript(url);
chrome.sendAsyncMessage("cancelPrompt");
state = {
msg : "hello!",
iconClass : "alert-icon",
titleHidden : true,
textHidden : true,
passHidden : true,
checkHidden : true,
textValue : "",
passValue : "",
checkMsg : "",
checked : false,
focused : "button0",
defButton : "button0",
};
action = {
buttonClick: "ok",
};
promptDone = handlePrompt(action);
var button = $("button");
dispatchMouseEvent(button, "mousedown");
dispatchMouseEvent(button, "mouseup");
// alert appears at this point, to be closed by the chrome script.
yield promptDone;
checkSelection();
chrome.sendAsyncMessage("cancelPrompt");
// using same state and action.
promptDone = handlePrompt(action);
var text = $("text");
dispatchMouseEvent(text, "mousedown");
dispatchMouseEvent(text, "mouseup");
// alert appears at this point, to be closed by the chrome script.
yield promptDone;
checkSelection();
chrome.destroy();
SimpleTest.finish();
}
});
function dispatchMouseEvent(target, type)
{

View File

@ -3,7 +3,9 @@
<title>Test for Bug 625187</title>
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SpawnTask.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
<script type="text/javascript" src="prompt_common.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
<!--
- Any copyright is dedicated to the Public Domain.
@ -13,7 +15,7 @@
- Mihai Sucan <mihai.sucan@gmail.com>
-->
</head>
<body onload="runtest()">
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=625187">Mozilla Bug 625187</a>
<p><button onclick="alert('hello world')">Button</button></p>
@ -25,72 +27,73 @@
<pre id="test"></pre>
<script class="testbody" type="text/javascript">
SimpleTest.waitForExplicitFinish();
var testNum = 0;
var dialogNum = 0;
function hasTabModalPrompts() {
var prefName = "prompts.tab_modal.enabled";
var Services = SpecialPowers.Cu.import("resource://gre/modules/Services.jsm").Services;
return Services.prefs.getPrefType(prefName) == Services.prefs.PREF_BOOL &&
Services.prefs.getBoolPref(prefName);
}
function runtest()
add_task(function* runTest()
{
isTabModal = hasTabModalPrompts();
// This test depends on tab modal prompts being enabled.
if (!isTabModal) {
todo(false, "Test disabled when tab modal prompts are not enabled.");
SimpleTest.finish();
return;
}
let url = SimpleTest.getTestFileURL("chromeScript.js");
let chrome = SpecialPowers.loadChromeScript(url);
state = {
msg : "hello world",
iconClass : "alert-icon",
titleHidden : true,
textHidden : true,
passHidden : true,
checkHidden : true,
textValue : "",
passValue : "",
checkMsg : "",
checked : false,
focused : "button0",
defButton : "button0",
};
action = {
buttonClick: "ok",
};
chrome.addMessageListener("promptCanceled", msg => {
checkSelection(msg.ui);
});
chrome.sendAsyncMessage("cancelPrompt");
promptDone = handlePrompt(action);
var button = document.querySelector("button");
dispatchMouseEvent(button, "click");
chrome.sendAsyncMessage("cancelPrompt");
yield promptDone;
// mostly reusing same state/action
state.titleHidden = false;
state.msg = "hello world 2";
promptDone = handlePrompt(action);
var iframe = document.getElementById("iframe_diff_origin");
button = SpecialPowers.wrap(iframe.contentWindow).document.getElementById("btn1");
dispatchMouseEvent(button, "click");
chrome.sendAsyncMessage("cancelPrompt");
yield promptDone;
// mostly reusing same state/action
state.titleHidden = true;
state.msg = "hello world 2";
promptDone = handlePrompt(action);
iframe = document.getElementById("iframe_same_origin");
button = iframe.contentWindow.document.getElementById("btn1");
dispatchMouseEvent(button, "click");
chrome.sendAsyncMessage("cancelPrompt");
yield promptDone;
// mostly reusing same state/action
state.msg = "hello world 3";
promptDone = handlePrompt(action);
button = iframe.contentWindow.document.getElementById("btn2");
dispatchMouseEvent(button, "click");
chrome.destroy();
SimpleTest.finish();
}
function checkSelection(ui)
{
dialogNum++;
if (dialogNum == 1 || dialogNum == 3 || dialogNum == 4)
ok(ui.infoTitle.hidden,
"dialog #" + dialogNum + ": the tabprompt infoTitle element is hidden");
else if (dialogNum == 2)
ok(!ui.infoTitle.hidden,
"dialog #" + dialogNum + ": the tabprompt infoTitle element is not hidden");
}
yield promptDone;
});
function dispatchMouseEvent(target, type)
{

View File

@ -3,67 +3,205 @@
<title>Test for DOM prompts</title>
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SpawnTask.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
<script type="text/javascript" src="prompt_common.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body onload="runtest()">
<body>
<pre id="test">
</pre>
<script class="testbody" type="text/javascript">
SimpleTest.waitForExplicitFinish();
var rv;
var state, action;
var selectionTest = false;
var testNum = 0;
add_task(function* test_alert_ok() {
info("Starting test: Alert");
state = {
msg : "This is the alert text.",
iconClass : "alert-icon",
titleHidden : true,
textHidden : true,
passHidden : true,
checkHidden : true,
textValue : "",
passValue : "",
checkMsg : "",
checked : false,
focused : "button0",
defButton : "button0",
};
action = {
buttonClick: "ok",
};
function hasTabModalPrompts() {
var prefName = "prompts.tab_modal.enabled";
var Services = SpecialPowers.Cu
.import("resource://gre/modules/Services.jsm")
.Services;
return Services.prefs.getPrefType(prefName) == Services.prefs.PREF_BOOL &&
Services.prefs.getBoolPref(prefName);
}
promptDone = handlePrompt(action);
function runtest()
{
isTabModal = hasTabModalPrompts();
if (!isTabModal) {
todo(false, "Test is run with tab modal prompts disabled.");
SimpleTest.finish();
return;
}
alert("This is the alert text.");
ok(true, "Test is run with tab modal prompts enabled.");
yield promptDone;
});
let url = SimpleTest.getTestFileURL("chromeScript.js");
let chrome = SpecialPowers.loadChromeScript(url);
chrome.sendAsyncMessage("cancelPrompt");
// bug 861605 made the arguments to alert/confirm optional (prompt already was).
add_task(function* test_alert_noargs() {
info("Starting test: Alert with no args");
state = {
msg : "",
iconClass : "alert-icon",
titleHidden : true,
textHidden : true,
passHidden : true,
checkHidden : true,
textValue : "",
passValue : "",
checkMsg : "",
checked : false,
focused : "button0",
defButton : "button0",
};
action = {
buttonClick: "ok",
};
try {
alert();
ok(true, "alert() without arguments should not throw!");
} catch(e) {
ok(false, "alert() without arguments should not throw!");
}
promptDone = handlePrompt(action);
chrome.sendAsyncMessage("cancelPrompt");
try {
alert();
ok(true, "alert() without arguments should not throw!");
} catch(e) {
ok(false, "alert() without arguments should not throw!");
}
try {
confirm();
ok(true, "confirm() without arguments should not throw!");
} catch(e) {
ok(false, "confirm() without arguments should not throw!");
}
yield promptDone;
});
chrome.destroy();
SimpleTest.finish();
}
function handleDialog(ui, testNum)
{
synthesizeMouse(ui.button0, 5, 5, { }, SpecialPowers.unwrap(ui.button0.ownerDocument.defaultView));
}
add_task(function* test_confirm_ok() {
info("Starting test: Confirm");
state = {
msg : "This is the confirm text.",
iconClass : "question-icon",
titleHidden : true,
textHidden : true,
passHidden : true,
checkHidden : true,
textValue : "",
passValue : "",
checkMsg : "",
checked : false,
focused : "button0",
defButton : "button0",
};
action = {
buttonClick: "ok",
};
promptDone = handlePrompt(action);
rv = confirm("This is the confirm text.");
is(rv, true, "check prompt return value");
yield promptDone;
});
// bug 861605 made the arguments to alert/confirm optional (prompt already was).
add_task(function* test_confirm_noargs() {
info("Starting test: Confirm with no args");
state = {
msg : "",
iconClass : "question-icon",
titleHidden : true,
textHidden : true,
passHidden : true,
checkHidden : true,
textValue : "",
passValue : "",
checkMsg : "",
checked : false,
focused : "button0",
defButton : "button0",
};
action = {
buttonClick: "ok",
};
promptDone = handlePrompt(action);
try {
rv = confirm();
ok(true, "confirm() without arguments should not throw!");
} catch(e) {
ok(false, "confirm() without arguments should not throw!");
}
is(rv, true, "check prompt return value");
yield promptDone;
});
add_task(function* test_prompt_ok() {
info("Starting test: Prompt");
state = {
msg : "This is the Prompt text.",
iconClass : "question-icon",
titleHidden : true,
textHidden : false,
passHidden : true,
checkHidden : true,
textValue : "",
passValue : "",
checkMsg : "",
checked : false,
focused : "textField",
defButton : "button0",
};
action = {
buttonClick: "ok",
};
promptDone = handlePrompt(action);
rv = prompt("This is the Prompt text.");
is(rv, "", "check prompt return value");
yield promptDone;
});
// bug 861605 made the arguments to alert/confirm optional (prompt already was).
add_task(function* test_prompt_noargs() {
info("Starting test: Prompt with no args");
state = {
msg : "",
iconClass : "question-icon",
titleHidden : true,
textHidden : false,
passHidden : true,
checkHidden : true,
textValue : "",
passValue : "",
checkMsg : "",
checked : false,
focused : "textField",
defButton : "button0",
};
action = {
buttonClick: "ok",
};
promptDone = handlePrompt(action);
try {
rv = prompt();
ok(true, "prompt() without arguments should not throw!");
} catch(e) {
ok(false, "prompt() without arguments should not throw!");
}
is(rv, "", "check prompt return value");
yield promptDone;
});
</script>
</body>

View File

@ -49,6 +49,7 @@ function* runTests() {
msg : "This is the alert text.",
title : "TestTitle",
iconClass : "alert-icon",
titleHidden : true,
textHidden : true,
passHidden : true,
checkHidden : true,
@ -78,6 +79,7 @@ function* runTests() {
msg : "This is the alertCheck text.",
title : "TestTitle",
iconClass : "alert-icon",
titleHidden : true,
textHidden : true,
passHidden : true,
checkHidden : true,
@ -107,6 +109,7 @@ function* runTests() {
msg : "This is the alertCheck text.",
title : "TestTitle",
iconClass : "alert-icon",
titleHidden : true,
textHidden : true,
passHidden : true,
checkHidden : false,
@ -139,6 +142,7 @@ function* runTests() {
msg : "This is the confirm text.",
title : "TestTitle",
iconClass : "question-icon",
titleHidden : true,
textHidden : true,
passHidden : true,
checkHidden : true,
@ -169,6 +173,7 @@ function* runTests() {
msg : "This is the confirm text.",
title : "TestTitle",
iconClass : "question-icon",
titleHidden : true,
textHidden : true,
passHidden : true,
checkHidden : true,
@ -199,6 +204,7 @@ function* runTests() {
msg : "This is the confirmCheck text.",
title : "TestTitle",
iconClass : "question-icon",
titleHidden : true,
textHidden : true,
passHidden : true,
checkHidden : true,
@ -229,6 +235,7 @@ function* runTests() {
msg : "This is the confirmCheck text.",
title : "TestTitle",
iconClass : "question-icon",
titleHidden : true,
textHidden : true,
passHidden : true,
checkHidden : true,
@ -259,6 +266,7 @@ function* runTests() {
msg : "This is the confirmCheck text.",
title : "TestTitle",
iconClass : "question-icon",
titleHidden : true,
textHidden : true,
passHidden : true,
checkHidden : false,
@ -292,6 +300,7 @@ function* runTests() {
msg : "This is the confirmCheck text.",
title : "TestTitle",
iconClass : "question-icon",
titleHidden : true,
textHidden : true,
passHidden : true,
checkHidden : false,
@ -325,6 +334,7 @@ function* runTests() {
msg : "This is the prompt text.",
title : "TestTitle",
iconClass : "question-icon",
titleHidden : true,
textHidden : false,
passHidden : true,
checkHidden : true,
@ -358,6 +368,7 @@ function* runTests() {
msg : "This is the prompt text.",
title : "TestTitle",
iconClass : "question-icon",
titleHidden : true,
textHidden : false,
passHidden : true,
checkHidden : true,
@ -390,6 +401,7 @@ function* runTests() {
msg : "This is the prompt text.",
title : "TestTitle",
iconClass : "question-icon",
titleHidden : true,
textHidden : false,
passHidden : true,
checkHidden : true,
@ -422,6 +434,7 @@ function* runTests() {
msg : "This is the prompt text.",
title : "TestTitle",
iconClass : "question-icon",
titleHidden : true,
textHidden : false,
passHidden : true,
checkHidden : true,
@ -455,6 +468,7 @@ function* runTests() {
msg : "This is the prompt text.",
title : "TestTitle",
iconClass : "question-icon",
titleHidden : true,
textHidden : false,
passHidden : true,
checkHidden : false,
@ -490,6 +504,7 @@ function* runTests() {
msg : "This is the prompt text.",
title : "TestTitle",
iconClass : "question-icon",
titleHidden : true,
textHidden : false,
passHidden : true,
checkHidden : false,
@ -526,6 +541,7 @@ function* runTests() {
msg : "This is the pUAP text.",
title : "TestTitle",
iconClass : "authentication-icon question-icon",
titleHidden : true,
textHidden : false,
passHidden : false,
checkHidden : false,
@ -565,6 +581,7 @@ function* runTests() {
msg : "This is the pUAP text.",
title : "TestTitle",
iconClass : "authentication-icon question-icon",
titleHidden : true,
textHidden : false,
passHidden : false,
checkHidden : false,
@ -604,6 +621,7 @@ function* runTests() {
msg : "This is the promptPassword text.",
title : "TestTitle",
iconClass : "authentication-icon question-icon",
titleHidden : true,
textHidden : true,
passHidden : false,
checkHidden : false,
@ -640,6 +658,7 @@ function* runTests() {
msg : "This is the promptPassword text.",
title : "TestTitle",
iconClass : "authentication-icon question-icon",
titleHidden : true,
textHidden : true,
passHidden : false,
checkHidden : false,
@ -676,6 +695,7 @@ function* runTests() {
msg : "This is the confirmEx text.",
title : "TestTitle",
iconClass : "question-icon",
titleHidden : true,
textHidden : true,
passHidden : true,
checkHidden : true,
@ -709,6 +729,7 @@ function* runTests() {
msg : "This is the confirmEx text.",
title : "TestTitle",
iconClass : "question-icon",
titleHidden : true,
textHidden : true,
passHidden : true,
checkHidden : true,
@ -742,6 +763,7 @@ function* runTests() {
msg : "This is the confirmEx text.",
title : "TestTitle",
iconClass : "question-icon",
titleHidden : true,
textHidden : true,
passHidden : true,
checkHidden : false,
@ -783,6 +805,7 @@ function* runTests() {
msg : "This is the confirmEx text.",
title : "TestTitle",
iconClass : "question-icon",
titleHidden : true,
textHidden : true,
passHidden : true,
checkHidden : false,
@ -825,6 +848,7 @@ function* runTests() {
msg : "This is the confirmEx text.",
title : "TestTitle",
iconClass : "question-icon",
titleHidden : true,
textHidden : true,
passHidden : true,
checkHidden : false,
@ -868,6 +892,7 @@ function* runTests() {
msg : "This is the alert text.",
title : "TestTitle",
iconClass : "alert-icon",
titleHidden : true,
textHidden : true,
passHidden : true,
checkHidden : true,
@ -900,6 +925,7 @@ function* runTests() {
msg : "This is the confirmEx delay text.",
title : "TestTitle",
iconClass : "question-icon",
titleHidden : true,
textHidden : true,
passHidden : true,
checkHidden : true,
@ -964,6 +990,7 @@ function* runTests() {
msg : 'Enter username and password for http://example.com',
title : "TestTitle",
iconClass : "authentication-icon question-icon",
titleHidden : true,
textHidden : false,
passHidden : false,
checkHidden : false,
@ -1004,6 +1031,7 @@ function* runTests() {
'abcdefghi \u2026"',
title : "TestTitle",
iconClass : "authentication-icon question-icon",
titleHidden : true,
textHidden : false,
passHidden : false,
checkHidden : false,
@ -1040,8 +1068,8 @@ function* runTests() {
}
}
let gChromeScript;
let state, action;
let usePromptService;
/*
* Run the body of the 3 times:
@ -1053,9 +1081,6 @@ let state, action;
add_task(function* runPromptTests() {
info("Process type: " + SpecialPowers.Services.appinfo.processType);
let url = SimpleTest.getTestFileURL("chromeScript.js");
gChromeScript = SpecialPowers.loadChromeScript(url);
isTabModal = false; usePromptService = true;
info("Running tests with: isTabModal=" + isTabModal + ", usePromptService=" + usePromptService);
yield* runTests();
@ -1069,8 +1094,6 @@ add_task(function* runPromptTests() {
info("Running tests with: isTabModal=" + isTabModal + ", usePromptService=" + usePromptService);
yield* runTests();
}
gChromeScript.destroy();
});
</script>

View File

@ -41,7 +41,7 @@ function checkPromptState(promptState, expectedState) {
let selectVal = {};
let isOK;
let gChromeScript, state, action;
let state, action;
function handlePrompt() {
return new Promise(resolve => {
@ -54,8 +54,6 @@ function handlePrompt() {
});
}
let url = SimpleTest.getTestFileURL("chromeScript.js");
gChromeScript = SpecialPowers.loadChromeScript(url);
// =====
add_task(function* test_select_empty_list() {
@ -142,11 +140,6 @@ add_task(function* test_cancel_prompt() {
yield promptDone;
});
// =====
add_task(function* cleanup() {
gChromeScript.destroy();
});
</script>
</pre>
</body>