mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1172627: Update test_instance_re-parent to account for bug 1158761; r=jimm
This commit is contained in:
parent
1783c9ae8d
commit
fea93d9fcd
@ -12,6 +12,8 @@
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED);
|
||||
|
||||
const MAX_CHECK_PLUGIN_STOPPED_ATTEMPTS = 5;
|
||||
var numCheckPluginStoppedAttempts = 0;
|
||||
var exceptionThrown = false;
|
||||
var p = null;
|
||||
var d1 = null;
|
||||
@ -38,6 +40,20 @@
|
||||
});
|
||||
}
|
||||
|
||||
function checkPluginStopped(callback, param) {
|
||||
if (numCheckPluginStoppedAttempts < MAX_CHECK_PLUGIN_STOPPED_ATTEMPTS &&
|
||||
!destroyed) {
|
||||
++numCheckPluginStoppedAttempts;
|
||||
SimpleTest.executeSoon(function() {
|
||||
checkPluginStopped(callback, param);
|
||||
});
|
||||
} else {
|
||||
info("Number of check plugin stopped attempts: " +
|
||||
numCheckPluginStoppedAttempts);
|
||||
callback(param);
|
||||
}
|
||||
}
|
||||
|
||||
function runTests(callback) {
|
||||
p = document.getElementById('plugin1');
|
||||
d1 = document.getElementById('div1');
|
||||
@ -71,22 +87,23 @@
|
||||
is(destroyed, false, "No instances should have been destroyed at this point.");
|
||||
is(p.getInstanceCount(), 0, "No new instances should have been created at this point.");
|
||||
|
||||
// Removing the instance for a full event loop *should* respawn
|
||||
d2.removeChild(p);
|
||||
SimpleTest.executeSoon(function() {
|
||||
d2.appendChild(p);
|
||||
SimpleTest.executeSoon(function() {
|
||||
try {
|
||||
is(p.getInstanceCount(), 1, "One new instance should have been created at this point.");
|
||||
} catch (e) {
|
||||
exceptionThrown = true;
|
||||
}
|
||||
is(exceptionThrown, false, "Testing for exception getting instance count from plugin.");
|
||||
checkPluginStopped(continueTestsAfterPluginDestruction, callback);
|
||||
});
|
||||
}
|
||||
|
||||
p.stopWatchingInstanceCount();
|
||||
callback.apply(null);
|
||||
});
|
||||
});
|
||||
function continueTestsAfterPluginDestruction(callback) {
|
||||
d2.appendChild(p);
|
||||
SimpleTest.executeSoon(function() {
|
||||
try {
|
||||
is(p.getInstanceCount(), 1, "One new instance should have been created at this point.");
|
||||
} catch (e) {
|
||||
exceptionThrown = true;
|
||||
}
|
||||
is(exceptionThrown, false, "Testing for exception getting instance count from plugin.");
|
||||
|
||||
p.stopWatchingInstanceCount();
|
||||
callback.apply(null);
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
Loading…
Reference in New Issue
Block a user