2009-05-08 05:32:32 +04:00
|
|
|
<!DOCTYPE HTML>
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<title>Test for plugin freezing and thawing</title>
|
|
|
|
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
|
|
|
|
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
|
|
|
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<div id="content" style="display: none">
|
|
|
|
</div>
|
|
|
|
<embed id='e1' type='application/x-test'></embed>
|
|
|
|
<script>
|
|
|
|
var e1 = document.getElementById('e1');
|
|
|
|
var w;
|
|
|
|
|
|
|
|
var testIndex = 0;
|
|
|
|
var tests;
|
|
|
|
|
|
|
|
window.addEventListener("unload", function() {
|
|
|
|
e1.stopWatchingInstanceCount();
|
2017-01-17 13:50:25 +03:00
|
|
|
});
|
2009-05-08 05:32:32 +04:00
|
|
|
|
|
|
|
function nextTest() {
|
|
|
|
if (testIndex == tests.length) {
|
2011-04-17 03:39:43 +04:00
|
|
|
if (w) {
|
|
|
|
w.close();
|
|
|
|
}
|
|
|
|
SimpleTest.waitForFocus(function() {
|
|
|
|
SimpleTest.finish();
|
|
|
|
});
|
2009-05-08 05:32:32 +04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
var test = tests[testIndex];
|
|
|
|
++testIndex;
|
|
|
|
test();
|
|
|
|
}
|
|
|
|
|
|
|
|
function waitForInstanceCount(n) {
|
|
|
|
if (e1.getInstanceCount() == n) {
|
|
|
|
ok(true, "reached instance count " + n);
|
|
|
|
nextTest();
|
|
|
|
return;
|
|
|
|
}
|
2011-04-17 03:39:43 +04:00
|
|
|
setTimeout(function() { waitForInstanceCount(n); }, 0);
|
2009-05-08 05:32:32 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
tests = [
|
|
|
|
function() { waitForInstanceCount(1); },
|
|
|
|
function() { w.location.href = "about:blank";
|
|
|
|
waitForInstanceCount(0); },
|
|
|
|
];
|
|
|
|
|
|
|
|
try {
|
|
|
|
e1.startWatchingInstanceCount();
|
|
|
|
var w = window.open("data:text/html,<embed id='e2' type='application/x-test'></embed>");
|
2011-04-17 03:39:43 +04:00
|
|
|
SimpleTest.waitForFocus(nextTest, w);
|
2009-05-08 05:32:32 +04:00
|
|
|
SimpleTest.waitForExplicitFinish();
|
|
|
|
} catch (err) {
|
|
|
|
todo(false, "Instances already being watched?");
|
|
|
|
}
|
|
|
|
|
|
|
|
</script>
|
|
|
|
<pre id="test">
|
|
|
|
</pre>
|
|
|
|
</body>
|
|
|
|
</html>
|