2009-12-21 09:37:32 -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-21 09:37:32 -08:00
|
|
|
|
|
|
|
<body onload="mainLoaded()">
|
|
|
|
<iframe id="iframe1" src="about:blank" width="600" height="600"></iframe>
|
|
|
|
|
|
|
|
<script class="testbody" type="application/javascript">
|
|
|
|
SimpleTest.waitForExplicitFinish();
|
|
|
|
|
|
|
|
var iframe = document.getElementById('iframe1');
|
|
|
|
|
|
|
|
function mainLoaded() {
|
2010-09-27 13:42:43 -07:00
|
|
|
if (!SimpleTest.testPluginIsOOP()) {
|
|
|
|
ok(true, "Skipping this test when test plugin is not OOP.");
|
2009-12-21 09:37:32 -08:00
|
|
|
SimpleTest.finish();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
var p = iframe.contentDocument.createElement('embed');
|
|
|
|
p.setAttribute('id', 'plugin1');
|
|
|
|
p.setAttribute('type', 'application/x-test');
|
|
|
|
p.setAttribute('width', '400');
|
|
|
|
p.setAttribute('height', '400');
|
|
|
|
p.setAttribute('drawmode', 'solid');
|
|
|
|
p.setAttribute('color', 'FF00FFFF');
|
|
|
|
p.setAttribute('newCrash', 'true');
|
|
|
|
iframe.contentDocument.body.appendChild(p);
|
|
|
|
|
2009-12-22 07:38:42 -08:00
|
|
|
// The plugin will now crash when it is instantiated, but
|
|
|
|
// that happens asynchronously. HACK: this should use an
|
|
|
|
// event instead of nested pending runnables, but I don't
|
|
|
|
// know of any DOM event that's fired when a plugin is
|
|
|
|
// instantiated.
|
|
|
|
SimpleTest.executeSoon(function() {
|
|
|
|
SimpleTest.executeSoon(function() {
|
|
|
|
ok(p.setColor === undefined,
|
|
|
|
"Plugin should have crashed on creation");
|
2009-12-21 09:37:32 -08:00
|
|
|
|
2009-12-22 07:38:42 -08:00
|
|
|
window.frameLoaded = reloaded1;
|
|
|
|
iframe.contentWindow.location.replace('crashing_subpage.html');
|
|
|
|
})
|
|
|
|
});
|
2009-12-21 09:37:32 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
function reloaded1() {
|
|
|
|
var p = iframe.contentDocument.getElementById('plugin1');
|
|
|
|
try {
|
|
|
|
p.setColor('FF00FF00');
|
2010-01-27 05:49:36 -08:00
|
|
|
ok(true, "Reloading after crash-on-new worked");
|
2009-12-21 09:37:32 -08:00
|
|
|
}
|
|
|
|
catch (e) {
|
2010-01-27 05:49:36 -08:00
|
|
|
ok(false, "Reloading after crash-on-new didn't give us a usable plugin");
|
2009-12-21 09:37:32 -08:00
|
|
|
}
|
|
|
|
p.crashOnDestroy();
|
2009-12-22 07:38:42 -08:00
|
|
|
// the child crash should happen here
|
|
|
|
p.parentNode.removeChild(p);
|
|
|
|
|
2009-12-21 09:37:32 -08:00
|
|
|
window.frameLoaded = reloaded2;
|
2010-01-27 05:49:36 -08:00
|
|
|
SimpleTest.executeSoon(function() {
|
|
|
|
iframe.contentWindow.location.reload();
|
|
|
|
});
|
2009-12-21 09:37:32 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
function reloaded2() {
|
|
|
|
var p = iframe.contentDocument.getElementById('plugin1');
|
|
|
|
try {
|
|
|
|
p.setColor('FF00FF00');
|
2010-01-27 05:49:36 -08:00
|
|
|
ok(true, "Reloading after crash-on-destroy worked");
|
2009-12-21 09:37:32 -08:00
|
|
|
}
|
|
|
|
catch (e) {
|
2010-01-27 05:49:36 -08:00
|
|
|
ok(false, "Reloading after crash-on-destroy didn't give us a usable plugin");
|
2009-12-21 09:37:32 -08:00
|
|
|
}
|
|
|
|
SimpleTest.finish();
|
|
|
|
}
|
|
|
|
</script>
|