1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
const FIRST_UPDATE_VERSION = "999998.0";
const SECOND_UPDATE_VERSION = "999999.0";
function prepareToDownloadVersion(version) {
setUpdateURL(
URL_HTTP_UPDATE_SJS +
`?detailsURL=${gDetailsURL}&promptWaitTime=0&appVersion=${version}`
);
}
add_task(async function aboutDialog_backgroundCheck_multiUpdate() {
await SpecialPowers.pushPrefEnv({
set: [[PREF_APP_UPDATE_STAGING_ENABLED, true]],
});
let params = {
version: FIRST_UPDATE_VERSION,
backgroundUpdate: true,
waitForUpdateState: STATE_PENDING,
};
await runAboutDialogUpdateTest(params, [
{
panelId: "applying",
checkActiveUpdate: { state: STATE_PENDING },
continueFile: CONTINUE_STAGING,
},
{
panelId: "apply",
checkActiveUpdate: { state: STATE_APPLIED },
continueFile: null,
},
() => {
prepareToDownloadVersion(SECOND_UPDATE_VERSION);
gAUS.checkForBackgroundUpdates();
},
{
panelId: "applying",
checkActiveUpdate: { state: STATE_PENDING },
// Don't pass a continue file in order to leave us in the staging state.
},
aboutDialog => {
aboutDialog.gAppUpdater._appUpdater.stop();
},
{
panelId: "checkForUpdates",
checkActiveUpdate: { state: STATE_PENDING },
expectedStateOverride: Ci.nsIApplicationUpdateService.STATE_STAGING,
},
]);
// Ideally this would go in a cleanup function. But this needs to happen
// before any other cleanup functions and for some reason cleanup functions
// do not always seem to execute in reverse registration order.
dump("Cleanup: Waiting for staging to finish.\n");
await continueFileHandler(CONTINUE_STAGING);
if (gAUS.currentState == Ci.nsIApplicationUpdateService.STATE_STAGING) {
await gAUS.stateTransition;
}
});
|