mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
6d3497ef39
--HG-- extra : rebase_source : 96ef81257c3b23ddf50daa9df85cae54559fe86a
71 lines
2.1 KiB
HTML
71 lines
2.1 KiB
HTML
<head>
|
|
<title>Plugin crashing</title>
|
|
<script type="application/javascript" src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
|
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
|
|
|
<body>
|
|
<iframe id="iframe1" src="crashing_subpage.html" width="600" height="600"></iframe>
|
|
|
|
<script class="testbody" type="application/javascript">
|
|
SimpleTest.waitForExplicitFinish();
|
|
|
|
var iframe = document.getElementById('iframe1');
|
|
|
|
window.frameLoaded = function frameLoaded_toCrash() {
|
|
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
|
|
var prefs = Components.classes['@mozilla.org/preferences-service;1']
|
|
.getService(Components.interfaces.nsIPrefBranch);
|
|
if (!prefs.getBoolPref('dom.ipc.plugins.enabled')) {
|
|
ok(true, "Skipping this test when IPC plugins are not enabled.");
|
|
SimpleTest.finish();
|
|
return;
|
|
}
|
|
|
|
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");
|
|
}
|
|
|
|
// 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");
|
|
}
|
|
}
|
|
|
|
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>
|