2009-12-14 06:14:28 -08:00
|
|
|
<head>
|
|
|
|
<title>Plugin crashing</title>
|
2010-08-24 10:29:34 -07:00
|
|
|
<script type="application/javascript" src="/MochiKit/packed.js"></script>
|
|
|
|
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
2009-12-14 06:14:28 -08:00
|
|
|
|
|
|
|
<body>
|
|
|
|
<script class="testbody" type="application/javascript">
|
|
|
|
SimpleTest.waitForExplicitFinish();
|
|
|
|
|
|
|
|
window.frameLoaded = function frameLoaded_toCrash() {
|
2010-09-27 13:42:43 -07:00
|
|
|
if (!SimpleTest.testPluginIsOOP()) {
|
|
|
|
ok(true, "Skipping this test when test plugin is not OOP.");
|
2009-12-14 06:14:28 -08:00
|
|
|
SimpleTest.finish();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2011-04-20 13:43:44 -07:00
|
|
|
var iframe = document.getElementById('iframe1');
|
2009-12-14 06:14:28 -08:00
|
|
|
var p = iframe.contentDocument.getElementById('plugin1');
|
|
|
|
|
|
|
|
p.setColor("FFFF00FF");
|
|
|
|
|
|
|
|
try {
|
|
|
|
p.crash();
|
|
|
|
ok(false, "p.crash() should throw an exception");
|
|
|
|
}
|
|
|
|
catch (e) {
|
|
|
|
ok(true, "p.crash() should throw an exception");
|
|
|
|
}
|
|
|
|
|
2010-04-19 07:35:51 -07:00
|
|
|
// Create random identifiers to test bug 560213
|
|
|
|
for (var i = 0; i < 5; ++i) {
|
|
|
|
var r = 'rid_' + Math.floor(Math.random() * 10000 + 1);
|
|
|
|
try {
|
|
|
|
ok(!(r in p), "unknown identifier in crashed plugin should fail silently");
|
|
|
|
}
|
|
|
|
catch (e) {
|
|
|
|
ok(false, "unknown identifier check threw");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-12-14 06:14:28 -08:00
|
|
|
try {
|
|
|
|
p.setColor("FFFF0000");
|
|
|
|
ok(false, "p.setColor should throw after the plugin crashes");
|
|
|
|
}
|
|
|
|
catch (e) {
|
|
|
|
ok(true, "p.setColor should throw after the plugin crashes");
|
|
|
|
}
|
|
|
|
|
|
|
|
window.frameLoaded = function reloaded() {
|
|
|
|
var p = iframe.contentDocument.getElementById('plugin1');
|
|
|
|
try {
|
|
|
|
p.setColor('FF00FF00');
|
|
|
|
ok(true, "Reloading worked");
|
|
|
|
}
|
|
|
|
catch (e) {
|
|
|
|
ok(false, "Reloading didn't give us a usable plugin");
|
|
|
|
}
|
|
|
|
SimpleTest.finish();
|
|
|
|
}
|
|
|
|
|
|
|
|
iframe.contentWindow.location.reload();
|
|
|
|
}
|
|
|
|
|
|
|
|
</script>
|
2011-04-20 13:43:44 -07:00
|
|
|
<iframe id="iframe1" src="crashing_subpage.html" width="600" height="600"></iframe>
|