Bug 683159: Explicitly gc in test_bug451286 so that intermittent assertions aren't spread across all the following tests.

This commit is contained in:
L. David Baron 2013-02-28 10:09:38 -08:00
parent b013e1e07b
commit 2693b89783
2 changed files with 22 additions and 2 deletions

View File

@ -23,14 +23,15 @@
var gFindBar = null;
var gBrowser;
var imports = ["SimpleTest", "ok", "snapshotWindow", "compareSnapshots"];
var imports = ["SimpleTest", "ok", "snapshotWindow", "compareSnapshots",
"parentFinish"];
for each (var name in imports) {
window[name] = window.opener.wrappedJSObject[name];
}
function finish() {
window.close();
SimpleTest.finish();
parentFinish();
}
function startTest() {

View File

@ -32,6 +32,25 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=451286
<script class="testbody" type="application/javascript">
<![CDATA[
// We trigger assertions that happen during the GC of our parent
// window.
SimpleTest.expectAssertions(5); // bug 683159
// To be called by the window we open.
function parentFinish() {
// This is called with JS code from the window we open on the
// stack. We need to GC everything in that window, so do that
// from a timeout and then call SimpleTest.finish().
setTimeout(doFinish, 0);
}
function doFinish() {
// Garbage collect objects created in this test can cause
// assertions, so GC now to blame those assertions to this test.
SpecialPowers.gc();
SimpleTest.finish();
}
/** Test for Bug 451286 **/
SimpleTest.waitForExplicitFinish();
window.open("bug451286_window.xul", "451286test",