gecko/toolkit/mozapps/update/test/chrome/test_9999_cleanup.xul
Ehsan Akhgari 904efc4f7a Bug 307181 - Stage Firefox updates in the background after they're downloaded, and replace the application directory on restart; r=rstrong,bbondy
When Firefox downloads an update, it previously kept the update around to apply
it on the next restart.  This patch changes this so that the updater program
is launched in the background as soon as the update has finished downloading
in order to stage the updated version of the application by copying the
existing installation directory to a temporary location and applying the update
on top of it, and replace the existing installation directory with the staged
directory on the next restart.

Because the replacing step is typically very fast, this patch eliminates the
wait for the update to be applied on restart, making it unnecessary to show a
progress dialog when restarting.

--HG--
rename : toolkit/mozapps/update/test/chrome/test_0092_finishedBackground.xul => toolkit/mozapps/update/test/chrome/test_0093_stagedBackground.xul
rename : toolkit/mozapps/update/test/unit/test_0110_general.js => toolkit/mozapps/update/test/unit/test_0113_general.js
rename : toolkit/mozapps/update/test/unit/test_0111_general.js => toolkit/mozapps/update/test/unit/test_0114_general.js
rename : toolkit/mozapps/update/test/unit/test_0112_general.js => toolkit/mozapps/update/test/unit/test_0115_general.js
rename : toolkit/mozapps/update/test/unit/test_0170_fileLocked_xp_win_complete.js => toolkit/mozapps/update/test/unit/test_0172_fileLocked_xp_win_complete.js
rename : toolkit/mozapps/update/test/unit/test_0171_fileLocked_xp_win_partial.js => toolkit/mozapps/update/test/unit/test_0173_fileLocked_xp_win_partial.js
rename : toolkit/mozapps/update/test/unit/test_0110_general.js => toolkit/mozapps/update/test_svc/unit/test_0113_general_svc.js
rename : toolkit/mozapps/update/test/unit/test_0111_general.js => toolkit/mozapps/update/test_svc/unit/test_0114_general_svc.js
rename : toolkit/mozapps/update/test/unit/test_0112_general.js => toolkit/mozapps/update/test_svc/unit/test_0115_general_svc.js
rename : toolkit/mozapps/update/test/unit/test_0170_fileLocked_xp_win_complete.js => toolkit/mozapps/update/test_svc/unit/test_0172_fileLocked_xp_win_complete_svc.js
rename : toolkit/mozapps/update/test/unit/test_0171_fileLocked_xp_win_partial.js => toolkit/mozapps/update/test_svc/unit/test_0173_fileLocked_xp_win_partial_svc.js
2012-05-22 10:50:04 -04:00

88 lines
2.5 KiB
XML

<?xml version="1.0"?>
<!--
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
/**
* Removes files and preferences for previous application update tests in case
* any of them had a fatal error. The test name ensures that it will run after
* all other tests as long as the test naming uses the same format as the
* existing tests.
*/
-->
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
<window title="Application Update test cleanup"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="runTest();">
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
<script type="application/javascript"
src="utils.js"/>
<script type="application/javascript">
<![CDATA[
/**
* If the application update tests left behind any of the files it uses it could
* be a very bad thing. The purpose of this test is to prevent that from
* happening.
*/
function runTest() {
debugDump("entering");
SimpleTest.waitForExplicitFinish();
closeUpdateWindow();
resetPrefs();
removeUpdateDirsAndFiles();
reloadUpdateManagerData();
let file = getUpdatesXMLFile(true);
ok(!file.exists(), file.path + " should not exist");
file = getUpdatesXMLFile(false);
ok(!file.exists(), file.path + " should not exist");
let dir = getUpdatesDir();
file = dir.clone();
file.append(FILE_UPDATE_STATUS);
ok(!file.exists(), file.path + " should not exist");
file = dir.clone();
file.append(FILE_UPDATE_ARCHIVE);
ok(!file.exists(), file.path + " should not exist");
let addonPrepDir = Services.dirsvc.get(NS_APP_USER_PROFILE_50_DIR,
AUS_Ci.nsILocalFile);
addonPrepDir.append(ADDON_PREP_DIR);
// Not being able to remove the directory used to create the test add-ons
// will not adversely affect subsequent tests so wrap it in a try lock and
// don't test whether its removal was successful.
try {
removeDirRecursive(addonPrepDir);
}
catch (e) {
dump("Unable to remove directory\n" +
"path: " + addonPrepDir.path + "\n" +
"Exception: " + e + "\n");
}
resetAddons(SimpleTest.finish);
}
]]>
</script>
<body xmlns="http://www.w3.org/1999/xhtml">
<p id="display"></p>
<div id="content" style="display: none"></div>
<pre id="test"></pre>
</body>
</window>