Mochitest for bug 397571, r=martijn.martijn

This commit is contained in:
martijn.martijn@gmail.com 2007-12-21 06:42:27 -08:00
Родитель cd9f29a349
Коммит d5d52613f5
2 изменённых файлов: 128 добавлений и 0 удалений

Просмотреть файл

@ -59,6 +59,7 @@ _TEST_FILES = \
test_bug389366.html \
test_bug393974.html \
test_bug396843.html \
test_bug397571.html \
test_bug400204.html \
test_bug404748.html \
$(NULL)

Просмотреть файл

@ -0,0 +1,127 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=397571
-->
<head>
<title>Test for Bug 397571</title>
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.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=397571">
Mozilla Bug 397571</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script class="testbody" type="text/javascript">
/** Test for Bug 397571 **/
// Get the interface
var utils = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor).
getInterface(Components.interfaces.nsIDOMWindowUtils);
// Try to call functions without privileges
var success = false;
try {
isForced = utils.docCharsetIsForced;
}
catch(e) {
success = true;
}
ok(success == true, "should throw");
success = false;
try {
contentDisposition = utils.getDocumentMetadata("content-disposition");
}
catch(e) {
success = true;
}
ok(success == true, "should throw");
var success = false;
try {
utils.sendMouseEvent("mousedown", 0, 0, 0, 1, 0);
}
catch(e) {
success = true;
}
ok(success, "should throw");
var success = false;
try {
utils.sendKeyEvent("keydown", 0, 0, 0);
}
catch(e) {
success = true;
}
ok(success, "should throw");
var success = false;
try {
utils.focus(null);
}
catch(e) {
success = true;
}
ok(success, "should throw");
// Get privilege
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
// Try again
var success = true;
try {
isForced = utils.docCharsetIsForced;
}
catch(e) {
success = false;
}
ok(success, "shouldn't throw");
var success = true;
try {
contentDisposition = utils.getDocumentMetadata("content-disposition");
}
catch(e) {
success = false;
}
ok(success, "shouldn't throw");
var success = true;
try {
utils.sendMouseEvent("mousedown", 0, 0, 0, 1, 0);
}
catch(e) {
success = false;
}
ok(success, "shouldn't throw");
var success = true;
try {
utils.sendKeyEvent("keydown", 0, 0, 0);
}
catch(e) {
success = false;
}
ok(success, "shouldn't throw");
var success = true;
try {
utils.focus(null);
}
catch(e) {
success = false;
}
ok(success, "shouldn't throw");
</script>
</pre>
</body>
</html>