mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-27 12:50:09 +00:00
Bug 1355818 - Wait for staging to finish in the update wizard if downloading is done before the download page appears. r=rstrong
MozReview-Commit-ID: 1hTj35SYnDi --HG-- extra : source : 7bc7221adbf29c5c2c0237a85291a606fcce3475 extra : amend_source : 3760803c007a4612b7661754cf768c8ec8b5b96c
This commit is contained in:
parent
4b4b439b5e
commit
e32594a18e
@ -755,9 +755,28 @@ var gDownloadingPage = {
|
||||
var um = CoC["@mozilla.org/updates/update-manager;1"].
|
||||
getService(CoI.nsIUpdateManager);
|
||||
var activeUpdate = um.activeUpdate;
|
||||
if (activeUpdate)
|
||||
if (activeUpdate) {
|
||||
gUpdates.setUpdate(activeUpdate);
|
||||
|
||||
// It's possible the update has already been downloaded and is being
|
||||
// applied by the time this page is shown, depending on how fast the
|
||||
// download goes and how quickly the 'next' button is clicked to get here.
|
||||
if (activeUpdate.state == STATE_PENDING ||
|
||||
activeUpdate.state == STATE_PENDING_ELEVATE ||
|
||||
activeUpdate.state == STATE_PENDING_SERVICE) {
|
||||
if (!activeUpdate.getProperty("stagingFailed")) {
|
||||
gUpdates.setButtons("hideButton", null, null, false);
|
||||
gUpdates.wiz.getButton("extra1").focus();
|
||||
|
||||
this._setUpdateApplying();
|
||||
return;
|
||||
} else {
|
||||
gUpdates.wiz.goTo("finished");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!gUpdates.update) {
|
||||
LOG("gDownloadingPage", "onPageShow - no valid update to download?!");
|
||||
return;
|
||||
@ -1207,10 +1226,17 @@ var gErrorPatchingPage = {
|
||||
switch (gUpdates.update.selectedPatch.state) {
|
||||
case STATE_APPLIED:
|
||||
case STATE_APPLIED_SERVICE:
|
||||
case STATE_PENDING:
|
||||
case STATE_PENDING_SERVICE:
|
||||
gUpdates.wiz.goTo("finished");
|
||||
break;
|
||||
case STATE_PENDING:
|
||||
case STATE_PENDING_SERVICE:
|
||||
let aus = CoC["@mozilla.org/updates/update-service;1"].
|
||||
getService(CoI.nsIApplicationUpdateService);
|
||||
if (!aus.canStageUpdates) {
|
||||
gUpdates.wiz.goTo("finished");
|
||||
break;
|
||||
}
|
||||
// intentional fallthrough
|
||||
case STATE_DOWNLOADING:
|
||||
gUpdates.wiz.goTo("downloading");
|
||||
break;
|
||||
|
@ -2798,6 +2798,9 @@ UpdateManager.prototype = {
|
||||
if (!handleUpdateFailure(update, parts[1])) {
|
||||
handleFallbackToCompleteUpdate(update, true);
|
||||
}
|
||||
|
||||
update.QueryInterface(Ci.nsIWritablePropertyBag);
|
||||
update.setProperty("stagingFailed", "true");
|
||||
}
|
||||
if (update.state == STATE_APPLIED && shouldUseService()) {
|
||||
writeStatusFile(getUpdatesDir(), update.state = STATE_APPLIED_SERVICE);
|
||||
|
@ -30,6 +30,9 @@ reason = Bug 1168003
|
||||
[test_0082_error_patchApplyFailure_complete_only.xul]
|
||||
[test_0083_error_patchApplyFailure_partial_complete.xul]
|
||||
[test_0084_error_patchApplyFailure_verify_failed.xul]
|
||||
[test_0085_error_patchApplyFailure_partial_complete_staging.xul]
|
||||
skip-if = asan
|
||||
reason = Bug 1168003
|
||||
[test_0092_finishedBackground.xul]
|
||||
[test_0093_restartNotification.xul]
|
||||
[test_0094_restartNotification_remote.xul]
|
||||
|
@ -0,0 +1,94 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/
|
||||
*/
|
||||
-->
|
||||
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
|
||||
|
||||
<window title="Update Wizard pages: error patching, download with staging, and finished (partial failed and download complete), with fast MAR download"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
onload="runTestDefault();">
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
|
||||
<script type="application/javascript"
|
||||
src="utils.js"/>
|
||||
|
||||
<script type="application/javascript">
|
||||
<![CDATA[
|
||||
|
||||
// This test forces the download to complete before the "next" button on the
|
||||
// errorpatching wizard page is clicked. This is done by creating the continue
|
||||
// file when the wizard loads to start the download, then clicking the "next"
|
||||
// button in the download's onStopRequest event listener.
|
||||
|
||||
const testDownloadListener = {
|
||||
onStartRequest(aRequest, aContext) { },
|
||||
|
||||
onProgress(aRequest, aContext, aProgress, aMaxProgress) { },
|
||||
|
||||
onStatus(aRequest, aContext, aStatus, aStatusText) { },
|
||||
|
||||
onStopRequest(aRequest, aContext, aStatus) {
|
||||
debugDump("clicking errorpatching page next button");
|
||||
gDocElem.getButton("next").click();
|
||||
gAUS.removeDownloadListener(this);
|
||||
},
|
||||
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIRequestObserver,
|
||||
Ci.nsIProgressEventSink])
|
||||
};
|
||||
|
||||
let TESTS = [ {
|
||||
pageid: PAGEID_ERROR_PATCHING,
|
||||
extraCheckFunction: createContinueFile
|
||||
}, {
|
||||
pageid: PAGEID_DOWNLOADING
|
||||
}, {
|
||||
pageid: PAGEID_FINISHED,
|
||||
buttonClick: "extra1",
|
||||
extraStartFunction: removeContinueFile
|
||||
} ];
|
||||
|
||||
gUseTestUpdater = true;
|
||||
|
||||
function runTest() {
|
||||
debugDump("entering");
|
||||
|
||||
removeContinueFile();
|
||||
|
||||
// Specify the url to update.sjs with a slowDownloadMar param so the ui can
|
||||
// load before the download completes.
|
||||
let slowDownloadURL = URL_HTTP_UPDATE_XML + "?slowDownloadMar=1";
|
||||
let patches = getLocalPatchString("partial", null, null, null, null, null,
|
||||
STATE_PENDING) +
|
||||
getLocalPatchString("complete", slowDownloadURL, null, null,
|
||||
null, "false");
|
||||
let updates = getLocalUpdateString(patches, null, null, null,
|
||||
Services.appinfo.version, null,
|
||||
null, null, null, null, "false");
|
||||
|
||||
writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), true);
|
||||
writeUpdatesToXMLFile(getLocalUpdatesXMLString(""), false);
|
||||
writeStatusFile(STATE_FAILED_READ_ERROR);
|
||||
|
||||
Services.prefs.setBoolPref(PREF_APP_UPDATE_STAGING_ENABLED, true);
|
||||
|
||||
reloadUpdateManagerData();
|
||||
|
||||
testPostUpdateProcessing();
|
||||
|
||||
gAUS.addDownloadListener(testDownloadListener);
|
||||
}
|
||||
|
||||
]]>
|
||||
</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>
|
@ -813,6 +813,7 @@ function setupPrefs() {
|
||||
Services.prefs.setIntPref(PREF_APP_UPDATE_PROMPTWAITTIME, 0);
|
||||
Services.prefs.setBoolPref(PREF_APP_UPDATE_SILENT, false);
|
||||
Services.prefs.setBoolPref(PREF_APP_UPDATE_DOORHANGER, false);
|
||||
Services.prefs.setIntPref(PREF_APP_UPDATE_DOWNLOADBACKGROUNDINTERVAL, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -910,6 +911,10 @@ function resetPrefs() {
|
||||
Services.prefs.clearUserPref(PREF_APP_UPDATE_DOORHANGER);
|
||||
}
|
||||
|
||||
if (Services.prefs.prefHasUserValue(PREF_APP_UPDATE_DOWNLOADBACKGROUNDINTERVAL)) {
|
||||
Services.prefs.clearUserPref(PREF_APP_UPDATE_DOWNLOADBACKGROUNDINTERVAL);
|
||||
}
|
||||
|
||||
try {
|
||||
Services.prefs.deleteBranch(PREFBRANCH_APP_UPDATE_NEVER);
|
||||
} catch (e) {
|
||||
|
@ -15,6 +15,7 @@ const PREF_APP_UPDATE_CHANNEL = "app.update.channel";
|
||||
const PREF_APP_UPDATE_DOORHANGER = "app.update.doorhanger";
|
||||
const PREF_APP_UPDATE_DOWNLOADPROMPTATTEMPTS = "app.update.download.attempts";
|
||||
const PREF_APP_UPDATE_DOWNLOADPROMPTMAXATTEMPTS = "app.update.download.maxAttempts";
|
||||
const PREF_APP_UPDATE_DOWNLOADBACKGROUNDINTERVAL = "app.update.download.backgroundInterval";
|
||||
const PREF_APP_UPDATE_ENABLED = "app.update.enabled";
|
||||
const PREF_APP_UPDATE_IDLETIME = "app.update.idletime";
|
||||
const PREF_APP_UPDATE_LOG = "app.update.log";
|
||||
|
Loading…
x
Reference in New Issue
Block a user