зеркало из https://github.com/mozilla/gecko-dev.git
Bug 861605 - Make the arguments to Window.alert, Window.confirm optional. r=Ms2ger
This commit is contained in:
Родитель
3cbc5c0ab7
Коммит
ca92e02d67
|
@ -185,8 +185,8 @@ interface nsIDOMWindow : nsISupports
|
|||
|
||||
|
||||
// user prompts
|
||||
void alert([Null(Stringify)] in DOMString text);
|
||||
boolean confirm(in DOMString text);
|
||||
void alert([optional, Null(Stringify)] in DOMString text);
|
||||
boolean confirm([optional] in DOMString text);
|
||||
|
||||
// prompt() should return a null string if cancel is pressed
|
||||
DOMString prompt([optional] in DOMString aMessage,
|
||||
|
|
|
@ -31,8 +31,8 @@ else
|
|||
|
||||
gDelayTestDriverEnd = true;
|
||||
|
||||
// Trying to set call window.alert() without any arguments will throw.
|
||||
window.alert();
|
||||
// Trying to set call window.showModalDialog() without any arguments will throw.
|
||||
window.showModalDialog();
|
||||
actual = 'No Error';
|
||||
}
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@ MOCHITEST_FILES = \
|
|||
test_bug619644.html \
|
||||
test_bug620145.html \
|
||||
test_bug625187.html \
|
||||
test_bug861605.html \
|
||||
prompt_common.js \
|
||||
bug619644_inner.html \
|
||||
bug625187_iframe.html \
|
||||
|
|
|
@ -0,0 +1,66 @@
|
|||
<html>
|
||||
<head>
|
||||
<title>Test for Bug 861605</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/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()">
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=861605">Mozilla Bug 861605</a>
|
||||
<pre id="test">
|
||||
</pre>
|
||||
|
||||
<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);
|
||||
}
|
||||
|
||||
function runtest()
|
||||
{
|
||||
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.");
|
||||
|
||||
startCallbackTimer();
|
||||
|
||||
try {
|
||||
alert();
|
||||
ok(true, "alert() without arguments should not throw!");
|
||||
} catch(e) {
|
||||
ok(false, "alert() without arguments should not throw!");
|
||||
}
|
||||
|
||||
startCallbackTimer();
|
||||
|
||||
try {
|
||||
confirm();
|
||||
ok(true, "confirm() without arguments should not throw!");
|
||||
} catch(e) {
|
||||
ok(false, "confirm() without arguments should not throw!");
|
||||
}
|
||||
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
function handleDialog(ui, testNum)
|
||||
{
|
||||
synthesizeMouse(ui.button0, 5, 5, { }, ui.button0.ownerDocument.defaultView);
|
||||
}
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
Загрузка…
Ссылка в новой задаче