зеркало из https://github.com/mozilla/pjs.git
99 строки
2.7 KiB
HTML
99 строки
2.7 KiB
HTML
<!DOCTYPE HTML>
|
|
<html>
|
|
<!--
|
|
https://bugzilla.mozilla.org/show_bug.cgi?id=489671
|
|
-->
|
|
<head>
|
|
<title>Test for Bug 489671</title>
|
|
<script type="application/javascript" src="/MochiKit/packed.js"></script>
|
|
<script type="application/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=489671">Mozilla Bug 489671</a>
|
|
<p id="display" onclick="throw 'Got click'"></p>
|
|
<div id="content" style="display: none">
|
|
|
|
</div>
|
|
<pre id="test">
|
|
<script type="application/javascript">
|
|
|
|
/** Test for Bug 489671 **/
|
|
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
|
|
|
|
const Cc = Components.classes;
|
|
const Ci = Components.interfaces;
|
|
const Cr = Components.results;
|
|
|
|
var listener = {
|
|
observe: function(message) {
|
|
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
|
|
|
|
is(message.QueryInterface(Ci.nsIScriptError).errorMessage,
|
|
"uncaught exception: Got click");
|
|
nextTest();
|
|
},
|
|
|
|
QueryInterface: function(iid) {
|
|
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
|
|
if (iid.equals(Ci.nsIConsoleListener) ||
|
|
iid.equals(Ci.nsISupports)) {
|
|
return this;
|
|
}
|
|
throw Cr.NS_NOINTERFACE;
|
|
}
|
|
};
|
|
|
|
|
|
function addListener() {
|
|
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
|
|
var consoleService =
|
|
Cc["@mozilla.org/consoleservice;1"].getService(Ci.nsIConsoleService);
|
|
consoleService.reset();
|
|
consoleService.registerListener(listener);
|
|
}
|
|
|
|
function removeListener() {
|
|
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
|
|
var consoleService =
|
|
Cc["@mozilla.org/consoleservice;1"].getService(Ci.nsIConsoleService);
|
|
consoleService.unregisterListener(listener);
|
|
}
|
|
|
|
SimpleTest.waitForExplicitFinish();
|
|
|
|
addListener();
|
|
// override window.onerror so it won't see our exceptions
|
|
window.onerror = function() {}
|
|
|
|
var testNum = 0;
|
|
function nextTest() {
|
|
switch(testNum++) {
|
|
case 0:
|
|
var event = document.createEvent("MouseEvents");
|
|
event.initMouseEvent("click", true, true, document.defaultView,
|
|
0, 0, 0, 0, 0, false, false, false, false, 0, null);
|
|
$("display").dispatchEvent(event);
|
|
break;
|
|
case 1:
|
|
var script = document.createElement("script");
|
|
script.textContent = "throw 'Got click'";
|
|
document.body.appendChild(script);
|
|
break;
|
|
case 2:
|
|
window.setTimeout("throw 'Got click'", 0);
|
|
break;
|
|
case 3:
|
|
removeListener();
|
|
SimpleTest.finish();
|
|
break;
|
|
}
|
|
}
|
|
|
|
nextTest();
|
|
|
|
</script>
|
|
</pre>
|
|
</body>
|
|
</html>
|