2007-12-21 06:42:27 -08:00
|
|
|
<!DOCTYPE HTML>
|
|
|
|
<html>
|
|
|
|
<!--
|
|
|
|
https://bugzilla.mozilla.org/show_bug.cgi?id=397571
|
|
|
|
-->
|
|
|
|
<head>
|
|
|
|
<title>Test for Bug 397571</title>
|
2009-05-06 13:46:04 -07:00
|
|
|
<script type="text/javascript" src="/MochiKit/packed.js"></script>
|
2007-12-21 06:42:27 -08:00
|
|
|
<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");
|
|
|
|
|
2009-10-23 04:43:24 -07:00
|
|
|
// TEMPORARY workaround for leak bug 524037: send a mouseup event as
|
|
|
|
// well so that we don't leak.
|
|
|
|
var success = true;
|
|
|
|
try {
|
|
|
|
utils.sendMouseEvent("mouseup", 0, 0, 0, 1, 0);
|
|
|
|
}
|
|
|
|
catch(e) {
|
|
|
|
success = false;
|
|
|
|
}
|
|
|
|
ok(success, "shouldn't throw");
|
|
|
|
|
2007-12-21 06:42:27 -08:00
|
|
|
</script>
|
|
|
|
</pre>
|
|
|
|
</body>
|
|
|
|
</html>
|