Bug 874502 part 4. Fix private browsing tests to not assume synchronous window closing. r=jdm

This commit is contained in:
Bobby Holley 2013-09-17 17:45:47 -04:00
parent 2d8e31dcb6
commit cd3879dd8f
2 changed files with 12 additions and 5 deletions

View File

@ -233,7 +233,9 @@ function doTest() {
privateWin.close();
testOnWindow(true, function(newPrivateWin) {
// The .close() call above will operate asynchronously, so execute the
// code below asynchronously as well.
function callback(newPrivateWin) {
is(newPrivateWin.content.localStorage.getItem("must disappear"), null, "private browsing values threw away");
is(newPrivateWin.content.localStorage.length, 0, "No items");
@ -245,7 +247,8 @@ function doTest() {
prefBranch.clearUserPref("browser.startup.page")
prefBranch.clearUserPref("browser.startup.homepage_override.mstone");
SimpleTest.finish();
});
};
SimpleTest.executeSoon(function() testOnWindow(true, callback));
});
});
}

View File

@ -99,10 +99,14 @@ function initAndRunTests() {
// the data should be on the clipboard inside the private browsing mode
is(data2, paste(), "Data successfully copied inside the private browsing mode");
aPrivateWindow.close();
// the data should no longer be on the clipboard at this stage
isnot(data2, paste(), "Data no longer available after leaving the private browsing mode");
SimpleTest.finish();
// The above .close() call will run asynchronously.
SimpleTest.executeSoon(function() {
// the data should no longer be on the clipboard at this stage
isnot(data2, paste(), "Data no longer available after leaving the private browsing mode");
SimpleTest.finish();
});
}, 0);
});
});