Main patch - Bug 660038 - Remove channel switching support. r=bbondy

This commit is contained in:
Robert Strong 2012-01-18 14:10:38 -08:00
Родитель e0d874d5a3
Коммит b60a2ee491
41 изменённых файлов: 58 добавлений и 1156 удалений

Просмотреть файл

@ -67,7 +67,6 @@ const PREF_APP_UPDATE_CERT_ERRORS = "app.update.cert.errors";
const PREF_APP_UPDATE_CERT_MAXERRORS = "app.update.cert.maxErrors";
const PREF_APP_UPDATE_CERT_REQUIREBUILTIN = "app.update.cert.requireBuiltIn";
const PREF_APP_UPDATE_CHANNEL = "app.update.channel";
const PREF_APP_UPDATE_DESIREDCHANNEL = "app.update.desiredChannel";
const PREF_APP_UPDATE_ENABLED = "app.update.enabled";
const PREF_APP_UPDATE_IDLETIME = "app.update.idletime";
const PREF_APP_UPDATE_INCOMPATIBLE_MODE = "app.update.incompatible.mode";
@ -114,7 +113,6 @@ const KEY_UPDROOT = "UpdRootD";
#endif
const DIR_UPDATES = "updates";
const FILE_CHANNELCHANGE = "channelchange";
const FILE_UPDATE_STATUS = "update.status";
const FILE_UPDATE_VERSION = "update.version";
#ifdef ANDROID
@ -642,15 +640,6 @@ function writeVersionFile(dir, version) {
writeStringToFile(versionFile, version);
}
function createChannelChangeFile(dir) {
var channelChangeFile = dir.clone();
channelChangeFile.append(FILE_CHANNELCHANGE);
if (!channelChangeFile.exists()) {
channelChangeFile.create(Ci.nsILocalFile.NORMAL_FILE_TYPE,
FileUtils.PERMS_FILE);
}
}
/**
* Removes the contents of the Updates Directory
*/
@ -781,19 +770,6 @@ function getUpdateChannel() {
return channel;
}
function getDesiredChannel() {
let desiredChannel = getPref("getCharPref", PREF_APP_UPDATE_DESIREDCHANNEL, null);
if (!desiredChannel)
return null;
if (desiredChannel == getUpdateChannel()) {
Services.prefs.clearUserPref(PREF_APP_UPDATE_DESIREDCHANNEL);
return null;
}
LOG("getDesiredChannel - channel set to: " + desiredChannel);
return desiredChannel;
}
/* Get the distribution pref values, from defaults only */
function getDistributionPrefValue(aPrefName) {
var prefValue = "default";
@ -1302,9 +1278,6 @@ const UpdateServiceFactory = {
*/
function UpdateService() {
Services.obs.addObserver(this, "xpcom-shutdown", false);
// This will clear the preference if the channel is the same as the
// application's channel.
getDesiredChannel();
}
UpdateService.prototype = {
@ -1409,9 +1382,6 @@ UpdateService.prototype = {
// Done with this update. Clean it up.
cleanupActiveUpdate();
if (Services.prefs.prefHasUserValue(PREF_APP_UPDATE_DESIREDCHANNEL))
Services.prefs.clearUserPref(PREF_APP_UPDATE_DESIREDCHANNEL);
}
else {
// If we hit an error, then the error code will be included in the status
@ -1590,12 +1560,6 @@ UpdateService.prototype = {
if (updates.length == 0)
return null;
if (getDesiredChannel()) {
LOG("UpdateService:selectUpdate - skipping version checks for channel " +
"change request");
return updates[0];
}
// Choose the newest of the available minor and major updates.
var majorUpdate = null;
var minorUpdate = null;
@ -1954,7 +1918,7 @@ UpdateService.prototype = {
// current application's version or the update's version is the same as the
// application's version and the build ID is the same as the application's
// build ID.
if (!getDesiredChannel() && update.appVersion &&
if (update.appVersion &&
(Services.vc.compare(update.appVersion, Services.appinfo.version) < 0 ||
update.buildID && update.buildID == Services.appinfo.appBuildID &&
update.appVersion == Services.appinfo.version)) {
@ -2151,9 +2115,8 @@ UpdateManager.prototype = {
* See nsIUpdateService.idl
*/
get activeUpdate() {
let currentChannel = getDesiredChannel() || getUpdateChannel();
if (this._activeUpdate &&
this._activeUpdate.channel != currentChannel) {
this._activeUpdate.channel != getUpdateChannel()) {
// User switched channels, clear out any old active updates and remove
// partial downloads
this._activeUpdate = null;
@ -2328,10 +2291,6 @@ Checker.prototype = {
getDistributionPrefValue(PREF_APP_DISTRIBUTION_VERSION));
url = url.replace(/\+/g, "%2B");
let desiredChannel = getDesiredChannel();
if (desiredChannel)
url += (url.indexOf("?") != -1 ? "&" : "?") + "newchannel=" + desiredChannel;
if (force)
url += (url.indexOf("?") != -1 ? "&" : "?") + "force=1";
@ -2350,11 +2309,6 @@ Checker.prototype = {
if (!url || (!this.enabled && !force))
return;
// If the user changes the update channel there can be leftover files from
// a previous download so clean the updates directory for manual checks.
if (force)
cleanUpUpdatesDir();
this._request = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"].
createInstance(Ci.nsISupports);
// This is here to let unit test code override XHR
@ -2422,7 +2376,7 @@ Checker.prototype = {
continue;
}
update.serviceURL = this.getUpdateURL(this._forced);
update.channel = getDesiredChannel() || getUpdateChannel();
update.channel = getUpdateChannel();
updates.push(update);
}
@ -2675,7 +2629,7 @@ Downloader.prototype = {
// If this is a patch that we know about, then select it. If it is a patch
// that we do not know about, then remove it and use our default logic.
var useComplete = getDesiredChannel() ? true : false;
var useComplete = false;
if (selectedPatch) {
LOG("Downloader:_selectPatch - found existing patch with state: " +
state);
@ -2922,8 +2876,6 @@ Downloader.prototype = {
// Tell the updater.exe we're ready to apply.
writeStatusFile(getUpdatesDir(), state);
writeVersionFile(getUpdatesDir(), this._update.appVersion);
if (getDesiredChannel())
createChannelChangeFile(getUpdatesDir());
this._update.installDate = (new Date()).getTime();
this._update.statusText = gUpdateBundle.GetStringFromName("installPending");
}

Просмотреть файл

@ -53,7 +53,6 @@ const PREF_APP_UPDATE_CERT_ERRORS = "app.update.cert.errors";
const PREF_APP_UPDATE_CERT_MAXERRORS = "app.update.cert.maxErrors";
const PREF_APP_UPDATE_CERT_REQUIREBUILTIN = "app.update.cert.requireBuiltIn";
const PREF_APP_UPDATE_CHANNEL = "app.update.channel";
const PREF_APP_UPDATE_DESIREDCHANNEL = "app.update.desiredChannel";
const PREF_APP_UPDATE_ENABLED = "app.update.enabled";
const PREF_APP_UPDATE_IDLETIME = "app.update.idletime";
const PREF_APP_UPDATE_LOG = "app.update.log";
@ -110,6 +109,8 @@ const PR_EXCL = 0x80;
const PERMS_FILE = 0644;
const PERMS_DIRECTORY = 0755;
const DEFAULT_UPDATE_VERSION = "999999.0";
#include sharedUpdateXML.js
AUS_Cu.import("resource://gre/modules/Services.jsm");

Просмотреть файл

@ -193,13 +193,16 @@ function getLocalPatchString(aType, aURL, aHashFunction, aHashValue, aSize,
* If not specified it will default to 'App Update Test'.
* @param aDisplayVersion (optional)
* The update's display version.
* If not specified it will default to 'version 99.0'.
* If not specified it will default to 'version #' where # is the value
* of DEFAULT_UPDATE_VERSION.
* @param aAppVersion (optional)
* The update's application version.
* If not specified it will default to '99.0'.
* If not specified it will default to the value of
* DEFAULT_UPDATE_VERSION.
* @param aPlatformVersion (optional)
* The update's platform version.
* If not specified it will default to '99.0'.
* If not specified it will default to the value of
* DEFAULT_UPDATE_VERSION.
* @param aBuildID (optional)
* The update's build id.
* If not specified it will default to '20080811053724'.
@ -253,14 +256,17 @@ function getUpdateString(aType, aName, aDisplayVersion, aAppVersion,
if (aDisplayVersion || !aVersion) {
displayVersion = "displayVersion=\"" +
(aDisplayVersion ? aDisplayVersion
: "version 99.0") + "\" ";
: "version " + DEFAULT_UPDATE_VERSION) +
"\" ";
}
// version has been deprecated in favor of displayVersion but it still needs
// to be tested for forward compatibility.
let version = aVersion ? "version=\"" + aVersion + "\" " : "";
let appVersion = "";
if (aAppVersion || !aExtensionVersion) {
appVersion = "appVersion=\"" + (aAppVersion ? aAppVersion : "99.0") + "\" ";
appVersion = "appVersion=\"" +
(aAppVersion ? aAppVersion : DEFAULT_UPDATE_VERSION) +
"\" ";
}
// extensionVersion has been deprecated in favor of appVersion but it still
// needs to be tested for forward compatibility.
@ -270,7 +276,8 @@ function getUpdateString(aType, aName, aDisplayVersion, aAppVersion,
let platformVersion = "";
if (aPlatformVersion) {
platformVersion = "platformVersion=\"" +
(aPlatformVersion ? aPlatformVersion : "99.0") + "\" ";
(aPlatformVersion ? aPlatformVersion
: DEFAULT_UPDATE_VERSION) + "\" ";
}
let buildID = aBuildID ? aBuildID : "20080811053724";
// XXXrstrong - not specifying a detailsURL will cause a leak due to bug 470244

Просмотреть файл

@ -1,347 +0,0 @@
DoUpdate: changing update channel
UPDATE TYPE complete
PREPARE REMOVEFILE precomplete
PREPARE REMOVEFILE a/b/searchplugins/searchpluginstext0
PREPARE REMOVEFILE a/b/searchplugins/searchpluginspng0.png
PREPARE REMOVEFILE a/b/removed-files
PREPARE REMOVEFILE a/b/extensions/extensions1/extensions1png1.png
PREPARE REMOVEFILE a/b/extensions/extensions0/extensions0text0
PREPARE REMOVEFILE a/b/exe0.exe
PREPARE REMOVEFILE a/b/defaults/pref/channel-prefs.js
PREPARE REMOVEFILE a/b/2/20/20text0
PREPARE REMOVEFILE a/b/2/20/20png0.png
PREPARE REMOVEFILE a/b/0/0exe0.exe
PREPARE REMOVEFILE a/b/0/00/00text0
PREPARE REMOVEDIR a/b/searchplugins/
PREPARE REMOVEDIR a/b/extensions/extensions1/
PREPARE REMOVEDIR a/b/extensions/extensions0/
PREPARE REMOVEDIR a/b/extensions/
PREPARE REMOVEDIR a/b/defaults/pref/
PREPARE REMOVEDIR a/b/defaults/
PREPARE REMOVEDIR a/b/2/20/
PREPARE REMOVEDIR a/b/2/
PREPARE REMOVEDIR a/b/0/00/
PREPARE REMOVEDIR a/b/0/
PREPARE REMOVEDIR a/b/
PREPARE REMOVEDIR a/
PREPARE ADD a/b/defaults/pref/channel-prefs.js
PREPARE ADD precomplete
PREPARE ADD a/b/searchplugins/searchpluginstext0
PREPARE ADD a/b/searchplugins/searchpluginspng1.png
PREPARE ADD a/b/searchplugins/searchpluginspng0.png
PREPARE ADD a/b/removed-files
PREPARE ADD a/b/extensions/extensions1/extensions1text0
PREPARE ADD a/b/extensions/extensions1/extensions1png1.png
PREPARE ADD a/b/extensions/extensions1/extensions1png0.png
PREPARE ADD a/b/extensions/extensions0/extensions0text0
PREPARE ADD a/b/extensions/extensions0/extensions0png1.png
PREPARE ADD a/b/extensions/extensions0/extensions0png0.png
PREPARE ADD a/b/exe0.exe
PREPARE ADD a/b/1/10/10text0
PREPARE ADD a/b/0/0exe0.exe
PREPARE ADD a/b/0/00/00text1
PREPARE ADD a/b/0/00/00text0
PREPARE ADD a/b/0/00/00png0.png
PREPARE REMOVEDIR a/b/9/99/
PREPARE REMOVEDIR a/b/9/99/
PREPARE REMOVEDIR a/b/9/98/
PREPARE REMOVEFILE a/b/9/97/970/97xtext0
PREPARE REMOVEFILE a/b/9/97/970/97xtext1
PREPARE REMOVEDIR a/b/9/97/970/
PREPARE REMOVEFILE a/b/9/97/971/97xtext0
PREPARE REMOVEFILE a/b/9/97/971/97xtext1
PREPARE REMOVEDIR a/b/9/97/971/
PREPARE REMOVEDIR a/b/9/97/
PREPARE REMOVEFILE a/b/9/96/96text0
PREPARE REMOVEFILE a/b/9/96/96text1
PREPARE REMOVEDIR a/b/9/96/
PREPARE REMOVEDIR a/b/9/95/
PREPARE REMOVEDIR a/b/9/95/
PREPARE REMOVEDIR a/b/9/94/
PREPARE REMOVEDIR a/b/9/94/
PREPARE REMOVEDIR a/b/9/93/
PREPARE REMOVEDIR a/b/9/92/
PREPARE REMOVEDIR a/b/9/91/
PREPARE REMOVEDIR a/b/9/90/
PREPARE REMOVEDIR a/b/9/90/
PREPARE REMOVEDIR a/b/8/89/
PREPARE REMOVEDIR a/b/8/89/
PREPARE REMOVEDIR a/b/8/88/
PREPARE REMOVEFILE a/b/8/87/870/87xtext0
PREPARE REMOVEFILE a/b/8/87/870/87xtext1
PREPARE REMOVEDIR a/b/8/87/870/
PREPARE REMOVEFILE a/b/8/87/871/87xtext0
PREPARE REMOVEFILE a/b/8/87/871/87xtext1
PREPARE REMOVEDIR a/b/8/87/871/
PREPARE REMOVEDIR a/b/8/87/
PREPARE REMOVEFILE a/b/8/86/86text0
PREPARE REMOVEFILE a/b/8/86/86text1
PREPARE REMOVEDIR a/b/8/86/
PREPARE REMOVEDIR a/b/8/85/
PREPARE REMOVEDIR a/b/8/85/
PREPARE REMOVEDIR a/b/8/84/
PREPARE REMOVEDIR a/b/8/84/
PREPARE REMOVEDIR a/b/8/83/
PREPARE REMOVEDIR a/b/8/82/
PREPARE REMOVEDIR a/b/8/81/
PREPARE REMOVEDIR a/b/8/80/
PREPARE REMOVEDIR a/b/8/80/
PREPARE REMOVEFILE a/b/7/70/7xtest.exe
PREPARE REMOVEFILE a/b/7/70/7xtext0
PREPARE REMOVEFILE a/b/7/70/7xtext1
PREPARE REMOVEDIR a/b/7/70/
PREPARE REMOVEFILE a/b/7/71/7xtest.exe
PREPARE REMOVEFILE a/b/7/71/7xtext0
PREPARE REMOVEFILE a/b/7/71/7xtext1
PREPARE REMOVEDIR a/b/7/71/
PREPARE REMOVEDIR a/b/7/
PREPARE REMOVEDIR a/b/6/
PREPARE REMOVEFILE a/b/5/5text1
PREPARE REMOVEFILE a/b/5/5text0
PREPARE REMOVEFILE a/b/5/5test.exe
PREPARE REMOVEFILE a/b/5/5text0
PREPARE REMOVEFILE a/b/5/5text1
PREPARE REMOVEDIR a/b/5/
PREPARE REMOVEFILE a/b/4/4text1
PREPARE REMOVEFILE a/b/4/4text0
PREPARE REMOVEDIR a/b/4/
PREPARE REMOVEFILE a/b/3/3text1
PREPARE REMOVEFILE a/b/3/3text0
EXECUTE REMOVEFILE precomplete
EXECUTE REMOVEFILE a/b/searchplugins/searchpluginstext0
EXECUTE REMOVEFILE a/b/searchplugins/searchpluginspng0.png
EXECUTE REMOVEFILE a/b/removed-files
EXECUTE REMOVEFILE a/b/extensions/extensions1/extensions1png1.png
EXECUTE REMOVEFILE a/b/extensions/extensions0/extensions0text0
EXECUTE REMOVEFILE a/b/exe0.exe
EXECUTE REMOVEFILE a/b/defaults/pref/channel-prefs.js
EXECUTE REMOVEFILE a/b/2/20/20text0
EXECUTE REMOVEFILE a/b/2/20/20png0.png
EXECUTE REMOVEFILE a/b/0/0exe0.exe
EXECUTE REMOVEFILE a/b/0/00/00text0
EXECUTE REMOVEDIR a/b/searchplugins/
EXECUTE REMOVEDIR a/b/extensions/extensions1/
EXECUTE REMOVEDIR a/b/extensions/extensions0/
EXECUTE REMOVEDIR a/b/extensions/
EXECUTE REMOVEDIR a/b/defaults/pref/
EXECUTE REMOVEDIR a/b/defaults/
EXECUTE REMOVEDIR a/b/2/20/
EXECUTE REMOVEDIR a/b/2/
EXECUTE REMOVEDIR a/b/0/00/
EXECUTE REMOVEDIR a/b/0/
EXECUTE REMOVEDIR a/b/
EXECUTE REMOVEDIR a/
EXECUTE ADD a/b/defaults/pref/channel-prefs.js
EXECUTE ADD precomplete
EXECUTE ADD a/b/searchplugins/searchpluginstext0
EXECUTE ADD a/b/searchplugins/searchpluginspng1.png
EXECUTE ADD a/b/searchplugins/searchpluginspng0.png
EXECUTE ADD a/b/removed-files
EXECUTE ADD a/b/extensions/extensions1/extensions1text0
EXECUTE ADD a/b/extensions/extensions1/extensions1png1.png
EXECUTE ADD a/b/extensions/extensions1/extensions1png0.png
EXECUTE ADD a/b/extensions/extensions0/extensions0text0
EXECUTE ADD a/b/extensions/extensions0/extensions0png1.png
EXECUTE ADD a/b/extensions/extensions0/extensions0png0.png
EXECUTE ADD a/b/exe0.exe
EXECUTE ADD a/b/1/10/10text0
EXECUTE ADD a/b/0/0exe0.exe
EXECUTE ADD a/b/0/00/00text1
EXECUTE ADD a/b/0/00/00text0
EXECUTE ADD a/b/0/00/00png0.png
EXECUTE REMOVEDIR a/b/9/99/
EXECUTE REMOVEDIR a/b/9/99/
EXECUTE REMOVEDIR a/b/9/98/
EXECUTE REMOVEFILE a/b/9/97/970/97xtext0
EXECUTE REMOVEFILE a/b/9/97/970/97xtext1
EXECUTE REMOVEDIR a/b/9/97/970/
EXECUTE REMOVEFILE a/b/9/97/971/97xtext0
EXECUTE REMOVEFILE a/b/9/97/971/97xtext1
EXECUTE REMOVEDIR a/b/9/97/971/
EXECUTE REMOVEDIR a/b/9/97/
EXECUTE REMOVEFILE a/b/9/96/96text0
EXECUTE REMOVEFILE a/b/9/96/96text1
EXECUTE REMOVEDIR a/b/9/96/
EXECUTE REMOVEDIR a/b/9/95/
EXECUTE REMOVEDIR a/b/9/95/
EXECUTE REMOVEDIR a/b/9/94/
EXECUTE REMOVEDIR a/b/9/94/
EXECUTE REMOVEDIR a/b/9/93/
EXECUTE REMOVEDIR a/b/9/92/
EXECUTE REMOVEDIR a/b/9/91/
EXECUTE REMOVEDIR a/b/9/90/
EXECUTE REMOVEDIR a/b/9/90/
EXECUTE REMOVEDIR a/b/8/89/
EXECUTE REMOVEDIR a/b/8/89/
EXECUTE REMOVEDIR a/b/8/88/
EXECUTE REMOVEFILE a/b/8/87/870/87xtext0
EXECUTE REMOVEFILE a/b/8/87/870/87xtext1
EXECUTE REMOVEDIR a/b/8/87/870/
EXECUTE REMOVEFILE a/b/8/87/871/87xtext0
EXECUTE REMOVEFILE a/b/8/87/871/87xtext1
EXECUTE REMOVEDIR a/b/8/87/871/
EXECUTE REMOVEDIR a/b/8/87/
EXECUTE REMOVEFILE a/b/8/86/86text0
EXECUTE REMOVEFILE a/b/8/86/86text1
EXECUTE REMOVEDIR a/b/8/86/
EXECUTE REMOVEDIR a/b/8/85/
EXECUTE REMOVEDIR a/b/8/85/
EXECUTE REMOVEDIR a/b/8/84/
EXECUTE REMOVEDIR a/b/8/84/
EXECUTE REMOVEDIR a/b/8/83/
EXECUTE REMOVEDIR a/b/8/82/
EXECUTE REMOVEDIR a/b/8/81/
EXECUTE REMOVEDIR a/b/8/80/
EXECUTE REMOVEDIR a/b/8/80/
EXECUTE REMOVEFILE a/b/7/70/7xtest.exe
EXECUTE REMOVEFILE a/b/7/70/7xtext0
EXECUTE REMOVEFILE a/b/7/70/7xtext1
EXECUTE REMOVEDIR a/b/7/70/
EXECUTE REMOVEFILE a/b/7/71/7xtest.exe
EXECUTE REMOVEFILE a/b/7/71/7xtext0
EXECUTE REMOVEFILE a/b/7/71/7xtext1
EXECUTE REMOVEDIR a/b/7/71/
EXECUTE REMOVEDIR a/b/7/
EXECUTE REMOVEDIR a/b/6/
EXECUTE REMOVEFILE a/b/5/5text1
EXECUTE REMOVEFILE a/b/5/5text0
EXECUTE REMOVEFILE a/b/5/5test.exe
EXECUTE REMOVEFILE a/b/5/5text0
file cannot be removed because it does not exist; skipping
EXECUTE REMOVEFILE a/b/5/5text1
file cannot be removed because it does not exist; skipping
EXECUTE REMOVEDIR a/b/5/
EXECUTE REMOVEFILE a/b/4/4text1
EXECUTE REMOVEFILE a/b/4/4text0
EXECUTE REMOVEDIR a/b/4/
EXECUTE REMOVEFILE a/b/3/3text1
EXECUTE REMOVEFILE a/b/3/3text0
FINISH REMOVEFILE precomplete
FINISH REMOVEFILE a/b/searchplugins/searchpluginstext0
FINISH REMOVEFILE a/b/searchplugins/searchpluginspng0.png
FINISH REMOVEFILE a/b/removed-files
FINISH REMOVEFILE a/b/extensions/extensions1/extensions1png1.png
FINISH REMOVEFILE a/b/extensions/extensions0/extensions0text0
FINISH REMOVEFILE a/b/exe0.exe
FINISH REMOVEFILE a/b/defaults/pref/channel-prefs.js
FINISH REMOVEFILE a/b/2/20/20text0
FINISH REMOVEFILE a/b/2/20/20png0.png
FINISH REMOVEFILE a/b/0/0exe0.exe
FINISH REMOVEFILE a/b/0/00/00text0
FINISH REMOVEDIR a/b/searchplugins/
removing directory: a/b/searchplugins/, rv: 0
FINISH REMOVEDIR a/b/extensions/extensions1/
removing directory: a/b/extensions/extensions1/, rv: 0
FINISH REMOVEDIR a/b/extensions/extensions0/
removing directory: a/b/extensions/extensions0/, rv: 0
FINISH REMOVEDIR a/b/extensions/
removing directory: a/b/extensions/, rv: 0
FINISH REMOVEDIR a/b/defaults/pref/
removing directory: a/b/defaults/pref/, rv: 0
FINISH REMOVEDIR a/b/defaults/
removing directory: a/b/defaults/, rv: 0
FINISH REMOVEDIR a/b/2/20/
FINISH REMOVEDIR a/b/2/
FINISH REMOVEDIR a/b/0/00/
removing directory: a/b/0/00/, rv: 0
FINISH REMOVEDIR a/b/0/
removing directory: a/b/0/, rv: 0
FINISH REMOVEDIR a/b/
removing directory: a/b/, rv: 0
FINISH REMOVEDIR a/
removing directory: a/, rv: 0
FINISH ADD a/b/defaults/pref/channel-prefs.js
FINISH ADD precomplete
FINISH ADD a/b/searchplugins/searchpluginstext0
FINISH ADD a/b/searchplugins/searchpluginspng1.png
FINISH ADD a/b/searchplugins/searchpluginspng0.png
FINISH ADD a/b/removed-files
FINISH ADD a/b/extensions/extensions1/extensions1text0
FINISH ADD a/b/extensions/extensions1/extensions1png1.png
FINISH ADD a/b/extensions/extensions1/extensions1png0.png
FINISH ADD a/b/extensions/extensions0/extensions0text0
FINISH ADD a/b/extensions/extensions0/extensions0png1.png
FINISH ADD a/b/extensions/extensions0/extensions0png0.png
FINISH ADD a/b/exe0.exe
FINISH ADD a/b/1/10/10text0
FINISH ADD a/b/0/0exe0.exe
FINISH ADD a/b/0/00/00text1
FINISH ADD a/b/0/00/00text0
FINISH ADD a/b/0/00/00png0.png
FINISH REMOVEDIR a/b/9/99/
FINISH REMOVEDIR a/b/9/99/
directory no longer exists; skipping
FINISH REMOVEDIR a/b/9/98/
FINISH REMOVEFILE a/b/9/97/970/97xtext0
FINISH REMOVEFILE a/b/9/97/970/97xtext1
FINISH REMOVEDIR a/b/9/97/970/
FINISH REMOVEFILE a/b/9/97/971/97xtext0
FINISH REMOVEFILE a/b/9/97/971/97xtext1
FINISH REMOVEDIR a/b/9/97/971/
FINISH REMOVEDIR a/b/9/97/
FINISH REMOVEFILE a/b/9/96/96text0
FINISH REMOVEFILE a/b/9/96/96text1
FINISH REMOVEDIR a/b/9/96/
FINISH REMOVEDIR a/b/9/95/
FINISH REMOVEDIR a/b/9/95/
directory no longer exists; skipping
FINISH REMOVEDIR a/b/9/94/
FINISH REMOVEDIR a/b/9/94/
directory no longer exists; skipping
FINISH REMOVEDIR a/b/9/93/
FINISH REMOVEDIR a/b/9/92/
removing directory: a/b/9/92/, rv: 0
FINISH REMOVEDIR a/b/9/91/
removing directory: a/b/9/91/, rv: 0
FINISH REMOVEDIR a/b/9/90/
FINISH REMOVEDIR a/b/9/90/
directory no longer exists; skipping
FINISH REMOVEDIR a/b/8/89/
FINISH REMOVEDIR a/b/8/89/
directory no longer exists; skipping
FINISH REMOVEDIR a/b/8/88/
FINISH REMOVEFILE a/b/8/87/870/87xtext0
FINISH REMOVEFILE a/b/8/87/870/87xtext1
FINISH REMOVEDIR a/b/8/87/870/
FINISH REMOVEFILE a/b/8/87/871/87xtext0
FINISH REMOVEFILE a/b/8/87/871/87xtext1
FINISH REMOVEDIR a/b/8/87/871/
FINISH REMOVEDIR a/b/8/87/
FINISH REMOVEFILE a/b/8/86/86text0
FINISH REMOVEFILE a/b/8/86/86text1
FINISH REMOVEDIR a/b/8/86/
FINISH REMOVEDIR a/b/8/85/
FINISH REMOVEDIR a/b/8/85/
directory no longer exists; skipping
FINISH REMOVEDIR a/b/8/84/
FINISH REMOVEDIR a/b/8/84/
directory no longer exists; skipping
FINISH REMOVEDIR a/b/8/83/
FINISH REMOVEDIR a/b/8/82/
removing directory: a/b/8/82/, rv: 0
FINISH REMOVEDIR a/b/8/81/
removing directory: a/b/8/81/, rv: 0
FINISH REMOVEDIR a/b/8/80/
FINISH REMOVEDIR a/b/8/80/
directory no longer exists; skipping
FINISH REMOVEFILE a/b/7/70/7xtest.exe
FINISH REMOVEFILE a/b/7/70/7xtext0
FINISH REMOVEFILE a/b/7/70/7xtext1
FINISH REMOVEDIR a/b/7/70/
FINISH REMOVEFILE a/b/7/71/7xtest.exe
FINISH REMOVEFILE a/b/7/71/7xtext0
FINISH REMOVEFILE a/b/7/71/7xtext1
FINISH REMOVEDIR a/b/7/71/
FINISH REMOVEDIR a/b/7/
FINISH REMOVEDIR a/b/6/
FINISH REMOVEFILE a/b/5/5text1
FINISH REMOVEFILE a/b/5/5text0
FINISH REMOVEFILE a/b/5/5test.exe
FINISH REMOVEDIR a/b/5/
FINISH REMOVEFILE a/b/4/4text1
FINISH REMOVEFILE a/b/4/4text0
FINISH REMOVEDIR a/b/4/
FINISH REMOVEFILE a/b/3/3text1
FINISH REMOVEFILE a/b/3/3text0
succeeded
calling QuitProgressUI

Просмотреть файл

@ -1,6 +1,4 @@
DoUpdate: changing update channel
UPDATE TYPE partial
DoUpdate: unable to change channel with a partial update
PREPARE ADD precomplete
PREPARE ADD a/b/searchplugins/searchpluginstext0
PREPARE PATCH a/b/searchplugins/searchpluginspng1.png

Просмотреть файл

@ -1,6 +1,4 @@
DoUpdate: changing update channel
UPDATE TYPE partial
DoUpdate: unable to change channel with a partial update
PREPARE ADD precomplete
PREPARE ADD a/b/searchplugins/searchpluginstext0
PREPARE PATCH a/b/searchplugins/searchpluginspng1.png

Просмотреть файл

@ -91,7 +91,6 @@ const UPDATER_BIN_FILE = "updater" + BIN_SUFFIX;
const MAINTENANCE_SERVICE_BIN_FILE = "maintenanceservice.exe";
const MAINTENANCE_SERVICE_INSTALLER_BIN_FILE = "maintenanceservice_installer.exe";
const UPDATES_DIR_SUFFIX = "_mar";
const CHANNEL_CHANGE_FILE = "channelchange";
const LOG_COMPLETE_SUCCESS = "data/complete_log_success";
const LOG_COMPLETE_CC_SUCCESS = "data/complete_cc_log_success";
@ -713,6 +712,10 @@ function runUpdateUsingService(aInitialStatus, aExpectedStatus,
// sanity check
do_check_eq(readStatusFile(updatesDir), aInitialStatus);
file = updatesDir.clone();
file.append(FILE_UPDATE_VERSION);
writeFile(file, DEFAULT_UPDATE_VERSION + "\n");
gServiceLaunchedCallbackArgs = [
"-no-remote",
"-process-updates",

Просмотреть файл

@ -95,17 +95,12 @@ function run_test_helper_pt1(aMsg, aExpectedStatusResult, aNextRunFunc) {
function check_test_helper_pt1_1() {
do_check_eq(gUpdateCount, 1);
let channelchange = getUpdatesDir();
channelchange.append("0");
channelchange.append(CHANNEL_CHANGE_FILE);
do_check_false(channelchange.exists());
gCheckFunc = check_test_helper_pt1_2;
var bestUpdate = gAUS.selectUpdate(gUpdates, gUpdateCount);
var state = gAUS.downloadUpdate(bestUpdate, false);
if (state == STATE_NONE || state == STATE_FAILED)
do_throw("nsIApplicationUpdateService:downloadUpdate returned " + state);
gAUS.addDownloadListener(downloadListener);
channelchange.create(AUS_Ci.nsIFile.FILE_TYPE, PERMS_FILE);
}
function check_test_helper_pt1_2() {

Просмотреть файл

@ -428,52 +428,5 @@ function run_test_pt13() {
function check_test_pt13() {
do_check_eq(getResult(gRequestURL), "?extra=param&force=1");
run_test_pt14();
}
// url with newchannel param that doesn't already have a param
function run_test_pt14() {
gCheckFunc = check_test_pt14;
Services.prefs.setCharPref(PREF_APP_UPDATE_DESIREDCHANNEL, "testchannel");
var url = URL_PREFIX;
logTestInfo("testing url with newchannel param that doesn't already have a " +
"param - " + url);
setUpdateURLOverride(url);
gUpdateChecker.checkForUpdates(updateCheckListener, false);
}
function check_test_pt14() {
do_check_eq(getResult(gRequestURL), "?newchannel=testchannel");
run_test_pt15();
}
// url with newchannel param that already has a param
function run_test_pt15() {
gCheckFunc = check_test_pt15;
Services.prefs.setCharPref(PREF_APP_UPDATE_DESIREDCHANNEL, "testchannel");
var url = URL_PREFIX + "?extra=param";
logTestInfo("testing url with newchannel param that already has a " +
"param - " + url);
setUpdateURLOverride(url);
gUpdateChecker.checkForUpdates(updateCheckListener, false);
}
function check_test_pt15() {
do_check_eq(getResult(gRequestURL), "?extra=param&newchannel=testchannel");
run_test_pt16();
}
// url with force and newchannel params
function run_test_pt16() {
gCheckFunc = check_test_pt16;
Services.prefs.setCharPref(PREF_APP_UPDATE_DESIREDCHANNEL, "testchannel");
var url = URL_PREFIX;
logTestInfo("testing url with force and newchannel params - " + url);
setUpdateURLOverride(url);
gUpdateChecker.checkForUpdates(updateCheckListener, true);
}
function check_test_pt16() {
do_check_eq(getResult(gRequestURL), "?newchannel=testchannel&force=1");
do_test_finished();
}

Просмотреть файл

@ -58,11 +58,6 @@ function run_test() {
log.append(FILE_UPDATE_LOG);
writeFile(log, "Last Update Log");
let channelchange = dir.clone();
channelchange.append("0");
channelchange.append(CHANNEL_CHANGE_FILE);
channelchange.create(AUS_Ci.nsIFile.FILE_TYPE, PERMS_FILE);
standardInit();
logTestInfo("testing " + log.path + " shouldn't exist");
@ -85,9 +80,6 @@ function run_test() {
logTestInfo("testing " + dir.path + " should exist (bug 512994)");
do_check_true(dir.exists());
logTestInfo("testing " + channelchange.path + " shouldn't exist");
do_check_false(channelchange.exists());
do_test_finished();
}

Просмотреть файл

@ -49,8 +49,7 @@ const MAX_TIME_DIFFERENCE = 60000;
// operations located in the precomplete file performed first.
const TEST_FILES = [
{
description : "Only added by update.manifest for complete updates " +
"when there is a channel change (add-cc)",
description : "Should never change",
fileName : "channel-prefs.js",
relPathDir : "a/b/defaults/pref/",
originalContents : "ShouldNotBeReplaced\n",

Просмотреть файл

@ -49,8 +49,7 @@ const MAX_TIME_DIFFERENCE = 60000;
// operations located in the precomplete file performed first.
const TEST_FILES = [
{
description : "Only added by update.manifest for complete updates " +
"when there is a channel change (add-cc)",
description : "Should never change",
fileName : "channel-prefs.js",
relPathDir : "a/b/defaults/pref/",
originalContents : "ShouldNotBeReplaced\n",
@ -279,12 +278,6 @@ function run_test() {
let updatesDir = do_get_file(TEST_ID + UPDATES_DIR_SUFFIX);
let applyToDir = getApplyDirFile();
// Check that trying to change channels for a partial update doesn't change
// the update channel (the channel-prefs.js file should not be updated).
let force = updatesDir.clone();
force.append(CHANNEL_CHANGE_FILE);
force.create(AUS_Ci.nsIFile.FILE_TYPE, PERMS_FILE);
// For Mac OS X set the last modified time for the root directory to a date in
// the past to test that the last modified time is updated on all updates since
// the precomplete file in the root of the bundle is renamed, etc. (bug 600098).

Просмотреть файл

@ -49,8 +49,7 @@ const MAX_TIME_DIFFERENCE = 60000;
// operations located in the precomplete file performed first.
const TEST_FILES = [
{
description : "Only added by update.manifest for complete updates " +
"when there is a channel change (add-cc)",
description : "Should never change",
fileName : "channel-prefs.js",
relPathDir : "a/b/defaults/pref/",
originalContents : "ShouldNotBeReplaced\n",
@ -272,12 +271,6 @@ function run_test() {
let updatesDir = do_get_file(TEST_ID + UPDATES_DIR_SUFFIX);
let applyToDir = getApplyDirFile();
// Check that trying to change channels for a failed partial update doesn't
// change the update channel (the channel-prefs.js file should not be updated).
let force = updatesDir.clone();
force.append(CHANNEL_CHANGE_FILE);
force.create(AUS_Ci.nsIFile.FILE_TYPE, PERMS_FILE);
// For Mac OS X set the last modified time for the root directory to a date in
// the past to test that the last modified time is updated on all updates since
// the precomplete file in the root of the bundle is renamed, etc. (bug 600098).

Просмотреть файл

@ -1,289 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
/* Channel change complete MAR file patch apply test */
const TEST_ID = "0120";
// All we care about is that the last modified time has changed so that Mac OS
// X Launch Services invalidates its cache so the test allows up to one minute
// difference in the last modified time.
const MAX_TIME_DIFFERENCE = 60000;
// The files are in the same order as they are applied from the mar
const TEST_FILES = [
{
description : "Added by update.manifest (add-cc)",
fileName : "channel-prefs.js",
relPathDir : "a/b/defaults/pref/",
originalContents : "ToBeReplacedWithFromComplete\n",
compareContents : "FromComplete\n",
originalFile : null,
compareFile : null,
originalPerms : 0767,
comparePerms : 0644
}, {
description : "Added by update.manifest (add)",
fileName : "precomplete",
relPathDir : "",
originalContents : null,
compareContents : null,
originalFile : "data/partial_precomplete",
compareFile : "data/complete_precomplete",
originalPerms : 0755,
comparePerms : 0644
}, {
description : "Added by update.manifest (add)",
fileName : "searchpluginstext0",
relPathDir : "a/b/searchplugins/",
originalContents : "ToBeReplacedWithFromComplete\n",
compareContents : "FromComplete\n",
originalFile : null,
compareFile : null,
originalPerms : 0775,
comparePerms : 0644
}, {
description : "Added by update.manifest (add)",
fileName : "searchpluginspng1.png",
relPathDir : "a/b/searchplugins/",
originalContents : null,
compareContents : null,
originalFile : null,
compareFile : "data/complete.png",
originalPerms : null,
comparePerms : 0644
}, {
description : "Added by update.manifest (add)",
fileName : "searchpluginspng0.png",
relPathDir : "a/b/searchplugins/",
originalContents : null,
compareContents : null,
originalFile : "data/partial.png",
compareFile : "data/complete.png",
originalPerms : 0666,
comparePerms : 0644
}, {
description : "Added by update.manifest (add)",
fileName : "removed-files",
relPathDir : "a/b/",
originalContents : null,
compareContents : null,
originalFile : "data/partial_removed-files",
compareFile : "data/complete_removed-files",
originalPerms : 0666,
comparePerms : 0644
}, {
description : "Added by update.manifest if the parent directory " +
"exists (add-if)",
fileName : "extensions1text0",
relPathDir : "a/b/extensions/extensions1/",
originalContents : null,
compareContents : "FromComplete\n",
originalFile : null,
compareFile : null,
originalPerms : null,
comparePerms : 0644
}, {
description : "Added by update.manifest if the parent directory " +
"exists (add-if)",
fileName : "extensions1png1.png",
relPathDir : "a/b/extensions/extensions1/",
originalContents : null,
compareContents : null,
originalFile : "data/partial.png",
compareFile : "data/complete.png",
originalPerms : 0666,
comparePerms : 0644
}, {
description : "Added by update.manifest if the parent directory " +
"exists (add-if)",
fileName : "extensions1png0.png",
relPathDir : "a/b/extensions/extensions1/",
originalContents : null,
compareContents : null,
originalFile : null,
compareFile : "data/complete.png",
originalPerms : null,
comparePerms : 0644
}, {
description : "Added by update.manifest if the parent directory " +
"exists (add-if)",
fileName : "extensions0text0",
relPathDir : "a/b/extensions/extensions0/",
originalContents : "ToBeReplacedWithFromComplete\n",
compareContents : "FromComplete\n",
originalFile : null,
compareFile : null,
originalPerms : null,
comparePerms : 0644
}, {
description : "Added by update.manifest if the parent directory " +
"exists (add-if)",
fileName : "extensions0png1.png",
relPathDir : "a/b/extensions/extensions0/",
originalContents : null,
compareContents : null,
originalFile : null,
compareFile : "data/complete.png",
originalPerms : null,
comparePerms : 0644
}, {
description : "Added by update.manifest if the parent directory " +
"exists (add-if)",
fileName : "extensions0png0.png",
relPathDir : "a/b/extensions/extensions0/",
originalContents : null,
compareContents : null,
originalFile : null,
compareFile : "data/complete.png",
originalPerms : null,
comparePerms : 0644
}, {
description : "Added by update.manifest (add)",
fileName : "exe0.exe",
relPathDir : "a/b/",
originalContents : null,
compareContents : null,
originalFile : "data/partial.png",
compareFile : "data/complete.png",
originalPerms : 0777,
comparePerms : 0755
}, {
description : "Added by update.manifest (add)",
fileName : "10text0",
relPathDir : "a/b/1/10/",
originalContents : "ToBeReplacedWithFromComplete\n",
compareContents : "FromComplete\n",
originalFile : null,
compareFile : null,
originalPerms : 0767,
comparePerms : 0644
}, {
description : "Added by update.manifest (add)",
fileName : "0exe0.exe",
relPathDir : "a/b/0/",
originalContents : null,
compareContents : null,
originalFile : "data/partial.png",
compareFile : "data/complete.png",
originalPerms : 0777,
comparePerms : 0755
}, {
description : "Added by update.manifest (add)",
fileName : "00text1",
relPathDir : "a/b/0/00/",
originalContents : "ToBeReplacedWithFromComplete\n",
compareContents : "FromComplete\n",
originalFile : null,
compareFile : null,
originalPerms : 0677,
comparePerms : 0644
}, {
description : "Added by update.manifest (add)",
fileName : "00text0",
relPathDir : "a/b/0/00/",
originalContents : "ToBeReplacedWithFromComplete\n",
compareContents : "FromComplete\n",
originalFile : null,
compareFile : null,
originalPerms : 0775,
comparePerms : 0644
}, {
description : "Added by update.manifest (add)",
fileName : "00png0.png",
relPathDir : "a/b/0/00/",
originalContents : null,
compareContents : null,
originalFile : null,
compareFile : "data/complete.png",
originalPerms : 0776,
comparePerms : 0644
}, {
description : "Removed by precomplete (remove)",
fileName : "20text0",
relPathDir : "a/b/2/20/",
originalContents : "ToBeDeleted\n",
compareContents : null,
originalFile : null,
compareFile : null,
originalPerms : null,
comparePerms : null
}, {
description : "Removed by precomplete (remove)",
fileName : "20png0.png",
relPathDir : "a/b/2/20/",
originalContents : "ToBeDeleted\n",
compareContents : null,
originalFile : null,
compareFile : null,
originalPerms : null,
comparePerms : null
}];
ADDITIONAL_TEST_DIRS = [
{
description : "Removed by precomplete (rmdir)",
relPathDir : "a/b/2/20/",
dirRemoved : true
}, {
description : "Removed by precomplete (rmdir)",
relPathDir : "a/b/2/",
dirRemoved : true
}];
function run_test() {
do_test_pending();
do_register_cleanup(cleanupUpdaterTest);
setupUpdaterTest(MAR_COMPLETE_FILE);
let updatesDir = do_get_file(TEST_ID + UPDATES_DIR_SUFFIX);
let applyToDir = getApplyDirFile();
// Check that trying to change channels for a complete update changes the
// update channel (the channel-prefs.js file should be updated).
let channelchange = updatesDir.clone();
channelchange.append(CHANNEL_CHANGE_FILE);
channelchange.create(AUS_Ci.nsIFile.FILE_TYPE, PERMS_FILE);
// For Mac OS X set the last modified time for the root directory to a date in
// the past to test that the last modified time is updated on a successful
// update (bug 600098).
if (IS_MACOSX) {
let now = Date.now();
let yesterday = now - (1000 * 60 * 60 * 24);
applyToDir.lastModifiedTime = yesterday;
}
// apply the complete mar
let exitValue = runUpdate();
logTestInfo("testing updater binary process exitValue for success when " +
"applying a complete mar");
do_check_eq(exitValue, 0);
logTestInfo("testing update.status should be " + STATE_SUCCEEDED);
let updatesDir = do_get_file(TEST_ID + UPDATES_DIR_SUFFIX);
do_check_eq(readStatusFile(updatesDir), STATE_SUCCEEDED);
// For Mac OS X check that the last modified time for a directory has been
// updated after a successful update (bug 600098).
if (IS_MACOSX) {
logTestInfo("testing last modified time on the apply to directory has " +
"changed after a successful update (bug 600098)");
let now = Date.now();
let timeDiff = Math.abs(applyToDir.lastModifiedTime - now);
do_check_true(timeDiff < MAX_TIME_DIFFERENCE);
}
checkFilesAfterUpdateSuccess();
// Sorting on Linux is different so skip this check for now.
if (!IS_UNIX) {
checkUpdateLogContents(LOG_COMPLETE_CC_SUCCESS);
}
logTestInfo("testing tobedeleted directory doesn't exist");
let toBeDeletedDir = getApplyDirFile("tobedeleted", true);
do_check_false(toBeDeletedDir.exists());
checkCallbackAppLog();
}

Просмотреть файл

@ -12,8 +12,7 @@ const MAR_COMPLETE_WIN_FILE = "data/complete_win.mar";
// operations located in the precomplete file performed first.
const TEST_FILES = [
{
description : "Only added by update.manifest for complete updates " +
"when there is a channel change (add-cc)",
description : "Should never change",
fileName : "channel-prefs.js",
relPathDir : "a/b/defaults/pref/",
originalContents : "ShouldNotBeReplaced\n",

Просмотреть файл

@ -12,8 +12,7 @@ const MAR_IN_USE_WIN_FILE = "data/partial_win.mar";
// operations located in the precomplete file performed first.
const TEST_FILES = [
{
description : "Only added by update.manifest for complete updates " +
"when there is a channel change (add-cc)",
description : "Should never change",
fileName : "channel-prefs.js",
relPathDir : "a/b/defaults/pref/",
originalContents : "ShouldNotBeReplaced\n",

Просмотреть файл

@ -15,8 +15,7 @@ const MAX_TIME_DIFFERENCE = 60000;
// operations located in the precomplete file performed first.
const TEST_FILES = [
{
description : "Only added by update.manifest for complete updates " +
"when there is a channel change (add-cc)",
description : "Should never change",
fileName : "channel-prefs.js",
relPathDir : "a/b/defaults/pref/",
originalContents : "ShouldNotBeReplaced\n",

Просмотреть файл

@ -11,8 +11,7 @@ const TEST_ID = "0160";
// operations located in the precomplete file performed first.
const TEST_FILES = [
{
description : "Only added by update.manifest for complete updates " +
"when there is a channel change (add-cc)",
description : "Should never change",
fileName : "channel-prefs.js",
relPathDir : "a/b/defaults/pref/",
originalContents : "ShouldNotBeReplaced\n",

Просмотреть файл

@ -11,8 +11,7 @@ const TEST_ID = "0170";
// operations located in the precomplete file performed first.
const TEST_FILES = [
{
description : "Only added by update.manifest for complete updates " +
"when there is a channel change (add-cc)",
description : "Should never change",
fileName : "channel-prefs.js",
relPathDir : "a/b/defaults/pref/",
originalContents : "ShouldNotBeReplaced\n",

Просмотреть файл

@ -11,8 +11,7 @@ const TEST_ID = "0171";
// operations located in the precomplete file performed first.
const TEST_FILES = [
{
description : "Only added by update.manifest for complete updates " +
"when there is a channel change (add-cc)",
description : "Should never change",
fileName : "channel-prefs.js",
relPathDir : "a/b/defaults/pref/",
originalContents : "ShouldNotBeReplaced\n",

Просмотреть файл

@ -11,8 +11,7 @@ const TEST_ID = "0180";
// operations located in the precomplete file performed first.
const TEST_FILES = [
{
description : "Only added by update.manifest for complete updates " +
"when there is a channel change (add-cc)",
description : "Should never change",
fileName : "channel-prefs.js",
relPathDir : "a/b/defaults/pref/",
originalContents : "ShouldNotBeReplaced\n",

Просмотреть файл

@ -12,8 +12,7 @@ const MAR_IN_USE_WIN_FILE = "data/partial_win.mar";
// operations located in the precomplete file performed first.
const TEST_FILES = [
{
description : "Only added by update.manifest for complete updates " +
"when there is a channel change (add-cc)",
description : "Should never change",
fileName : "channel-prefs.js",
relPathDir : "a/b/defaults/pref/",
originalContents : "ShouldNotBeReplaced\n",

Просмотреть файл

@ -11,8 +11,7 @@ const TEST_ID = "0182";
// operations located in the precomplete file performed first.
const TEST_FILES = [
{
description : "Only added by update.manifest for complete updates " +
"when there is a channel change (add-cc)",
description : "Should never change",
fileName : "channel-prefs.js",
relPathDir : "a/b/defaults/pref/",
originalContents : "ShouldNotBeReplaced\n",

Просмотреть файл

@ -12,8 +12,7 @@ const MAR_IN_USE_WIN_FILE = "data/partial.mar";
// operations located in the precomplete file performed first.
const TEST_FILES = [
{
description : "Only added by update.manifest for complete updates " +
"when there is a channel change (add-cc)",
description : "Should never change",
fileName : "channel-prefs.js",
relPathDir : "a/b/defaults/pref/",
originalContents : "ShouldNotBeReplaced\n",

Просмотреть файл

@ -1,5 +1,4 @@
[test_0110_general.js]
[test_0111_general.js]
[test_0112_general.js]
[test_0120_channelChange_complete.js]
[test_0200_app_launch_apply_update.js]

Просмотреть файл

@ -49,8 +49,7 @@ const MAX_TIME_DIFFERENCE = 60000;
// operations located in the precomplete file performed first.
const TEST_FILES = [
{
description : "Only added by update.manifest for complete updates " +
"when there is a channel change (add-cc)",
description : "Should never change",
fileName : "channel-prefs.js",
relPathDir : "a/b/defaults/pref/",
originalContents : "ShouldNotBeReplaced\n",

Просмотреть файл

@ -49,8 +49,7 @@ const MAX_TIME_DIFFERENCE = 60000;
// operations located in the precomplete file performed first.
const TEST_FILES = [
{
description : "Only added by update.manifest for complete updates " +
"when there is a channel change (add-cc)",
description : "Should never change",
fileName : "channel-prefs.js",
relPathDir : "a/b/defaults/pref/",
originalContents : "ShouldNotBeReplaced\n",
@ -282,12 +281,6 @@ function run_test() {
let updatesDir = do_get_file(TEST_ID + UPDATES_DIR_SUFFIX);
// Check that trying to change channels for a partial update doesn't change
// the update channel (the channel-prefs.js file should not be updated).
let force = updatesDir.clone();
force.append(CHANNEL_CHANGE_FILE);
force.create(AUS_Ci.nsIFile.FILE_TYPE, PERMS_FILE);
// apply the partial mar
runUpdateUsingService(STATE_PENDING_SVC, STATE_SUCCEEDED, checkUpdateApplied);
}

Просмотреть файл

@ -49,8 +49,7 @@ const MAX_TIME_DIFFERENCE = 60000;
// operations located in the precomplete file performed first.
const TEST_FILES = [
{
description : "Only added by update.manifest for complete updates " +
"when there is a channel change (add-cc)",
description : "Should never change",
fileName : "channel-prefs.js",
relPathDir : "a/b/defaults/pref/",
originalContents : "ShouldNotBeReplaced\n",
@ -275,12 +274,6 @@ function run_test() {
let updatesDir = do_get_file(TEST_ID + UPDATES_DIR_SUFFIX);
// Check that trying to change channels for a failed partial update doesn't
// change the update channel (the channel-prefs.js file should not be updated).
let force = updatesDir.clone();
force.append(CHANNEL_CHANGE_FILE);
force.create(AUS_Ci.nsIFile.FILE_TYPE, PERMS_FILE);
// apply the partial mar
runUpdateUsingService(STATE_PENDING_SVC, STATE_FAILED, checkUpdateApplied);
}

Просмотреть файл

@ -1,268 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
/* Channel change complete MAR file patch apply test */
const TEST_ID = "0120_svc";
// All we care about is that the last modified time has changed so that Mac OS
// X Launch Services invalidates its cache so the test allows up to one minute
// difference in the last modified time.
const MAX_TIME_DIFFERENCE = 60000;
// The files are in the same order as they are applied from the mar
const TEST_FILES = [
{
description : "Added by update.manifest (add-cc)",
fileName : "channel-prefs.js",
relPathDir : "a/b/defaults/pref/",
originalContents : "ToBeReplacedWithFromComplete\n",
compareContents : "FromComplete\n",
originalFile : null,
compareFile : null,
originalPerms : 0767,
comparePerms : 0644
}, {
description : "Added by update.manifest (add)",
fileName : "precomplete",
relPathDir : "",
originalContents : null,
compareContents : null,
originalFile : "data/partial_precomplete",
compareFile : "data/complete_precomplete",
originalPerms : 0755,
comparePerms : 0644
}, {
description : "Added by update.manifest (add)",
fileName : "searchpluginstext0",
relPathDir : "a/b/searchplugins/",
originalContents : "ToBeReplacedWithFromComplete\n",
compareContents : "FromComplete\n",
originalFile : null,
compareFile : null,
originalPerms : 0775,
comparePerms : 0644
}, {
description : "Added by update.manifest (add)",
fileName : "searchpluginspng1.png",
relPathDir : "a/b/searchplugins/",
originalContents : null,
compareContents : null,
originalFile : null,
compareFile : "data/complete.png",
originalPerms : null,
comparePerms : 0644
}, {
description : "Added by update.manifest (add)",
fileName : "searchpluginspng0.png",
relPathDir : "a/b/searchplugins/",
originalContents : null,
compareContents : null,
originalFile : "data/partial.png",
compareFile : "data/complete.png",
originalPerms : 0666,
comparePerms : 0644
}, {
description : "Added by update.manifest (add)",
fileName : "removed-files",
relPathDir : "a/b/",
originalContents : null,
compareContents : null,
originalFile : "data/partial_removed-files",
compareFile : "data/complete_removed-files",
originalPerms : 0666,
comparePerms : 0644
}, {
description : "Added by update.manifest if the parent directory " +
"exists (add-if)",
fileName : "extensions1text0",
relPathDir : "a/b/extensions/extensions1/",
originalContents : null,
compareContents : "FromComplete\n",
originalFile : null,
compareFile : null,
originalPerms : null,
comparePerms : 0644
}, {
description : "Added by update.manifest if the parent directory " +
"exists (add-if)",
fileName : "extensions1png1.png",
relPathDir : "a/b/extensions/extensions1/",
originalContents : null,
compareContents : null,
originalFile : "data/partial.png",
compareFile : "data/complete.png",
originalPerms : 0666,
comparePerms : 0644
}, {
description : "Added by update.manifest if the parent directory " +
"exists (add-if)",
fileName : "extensions1png0.png",
relPathDir : "a/b/extensions/extensions1/",
originalContents : null,
compareContents : null,
originalFile : null,
compareFile : "data/complete.png",
originalPerms : null,
comparePerms : 0644
}, {
description : "Added by update.manifest if the parent directory " +
"exists (add-if)",
fileName : "extensions0text0",
relPathDir : "a/b/extensions/extensions0/",
originalContents : "ToBeReplacedWithFromComplete\n",
compareContents : "FromComplete\n",
originalFile : null,
compareFile : null,
originalPerms : null,
comparePerms : 0644
}, {
description : "Added by update.manifest if the parent directory " +
"exists (add-if)",
fileName : "extensions0png1.png",
relPathDir : "a/b/extensions/extensions0/",
originalContents : null,
compareContents : null,
originalFile : null,
compareFile : "data/complete.png",
originalPerms : null,
comparePerms : 0644
}, {
description : "Added by update.manifest if the parent directory " +
"exists (add-if)",
fileName : "extensions0png0.png",
relPathDir : "a/b/extensions/extensions0/",
originalContents : null,
compareContents : null,
originalFile : null,
compareFile : "data/complete.png",
originalPerms : null,
comparePerms : 0644
}, {
description : "Added by update.manifest (add)",
fileName : "exe0.exe",
relPathDir : "a/b/",
originalContents : null,
compareContents : null,
originalFile : "data/partial.png",
compareFile : "data/complete.png",
originalPerms : 0777,
comparePerms : 0755
}, {
description : "Added by update.manifest (add)",
fileName : "10text0",
relPathDir : "a/b/1/10/",
originalContents : "ToBeReplacedWithFromComplete\n",
compareContents : "FromComplete\n",
originalFile : null,
compareFile : null,
originalPerms : 0767,
comparePerms : 0644
}, {
description : "Added by update.manifest (add)",
fileName : "0exe0.exe",
relPathDir : "a/b/0/",
originalContents : null,
compareContents : null,
originalFile : "data/partial.png",
compareFile : "data/complete.png",
originalPerms : 0777,
comparePerms : 0755
}, {
description : "Added by update.manifest (add)",
fileName : "00text1",
relPathDir : "a/b/0/00/",
originalContents : "ToBeReplacedWithFromComplete\n",
compareContents : "FromComplete\n",
originalFile : null,
compareFile : null,
originalPerms : 0677,
comparePerms : 0644
}, {
description : "Added by update.manifest (add)",
fileName : "00text0",
relPathDir : "a/b/0/00/",
originalContents : "ToBeReplacedWithFromComplete\n",
compareContents : "FromComplete\n",
originalFile : null,
compareFile : null,
originalPerms : 0775,
comparePerms : 0644
}, {
description : "Added by update.manifest (add)",
fileName : "00png0.png",
relPathDir : "a/b/0/00/",
originalContents : null,
compareContents : null,
originalFile : null,
compareFile : "data/complete.png",
originalPerms : 0776,
comparePerms : 0644
}, {
description : "Removed by precomplete (remove)",
fileName : "20text0",
relPathDir : "a/b/2/20/",
originalContents : "ToBeDeleted\n",
compareContents : null,
originalFile : null,
compareFile : null,
originalPerms : null,
comparePerms : null
}, {
description : "Removed by precomplete (remove)",
fileName : "20png0.png",
relPathDir : "a/b/2/20/",
originalContents : "ToBeDeleted\n",
compareContents : null,
originalFile : null,
compareFile : null,
originalPerms : null,
comparePerms : null
}];
ADDITIONAL_TEST_DIRS = [
{
description : "Removed by precomplete (rmdir)",
relPathDir : "a/b/2/20/",
dirRemoved : true
}, {
description : "Removed by precomplete (rmdir)",
relPathDir : "a/b/2/",
dirRemoved : true
}];
function run_test() {
if (!shouldRunServiceTest()) {
return;
}
do_test_pending();
do_register_cleanup(cleanupUpdaterTest);
setupUpdaterTest(MAR_COMPLETE_FILE);
let updatesDir = do_get_file(TEST_ID + UPDATES_DIR_SUFFIX);
// Check that trying to change channels for a complete update changes the
// update channel (the channel-prefs.js file should be updated).
let channelchange = updatesDir.clone();
channelchange.append(CHANNEL_CHANGE_FILE);
channelchange.create(AUS_Ci.nsIFile.FILE_TYPE, PERMS_FILE);
runUpdateUsingService(STATE_PENDING_SVC, STATE_SUCCEEDED, checkUpdateApplied);
}
function checkUpdateApplied() {
logTestInfo("testing update.status should be " + STATE_SUCCEEDED);
let updatesDir = do_get_file(TEST_ID + UPDATES_DIR_SUFFIX);
do_check_eq(readStatusFile(updatesDir), STATE_SUCCEEDED);
checkFilesAfterUpdateSuccess();
checkUpdateLogContents(LOG_COMPLETE_CC_SUCCESS);
logTestInfo("testing tobedeleted directory doesn't exist");
let toBeDeletedDir = getApplyDirFile("tobedeleted", true);
do_check_false(toBeDeletedDir.exists());
checkCallbackServiceLog();
}

Просмотреть файл

@ -12,8 +12,7 @@ const MAR_COMPLETE_WIN_FILE = "data/complete_win.mar";
// operations located in the precomplete file performed first.
const TEST_FILES = [
{
description : "Only added by update.manifest for complete updates " +
"when there is a channel change (add-cc)",
description : "Should never change",
fileName : "channel-prefs.js",
relPathDir : "a/b/defaults/pref/",
originalContents : "ShouldNotBeReplaced\n",

Просмотреть файл

@ -12,8 +12,7 @@ const MAR_IN_USE_WIN_FILE = "data/partial_win.mar";
// operations located in the precomplete file performed first.
const TEST_FILES = [
{
description : "Only added by update.manifest for complete updates " +
"when there is a channel change (add-cc)",
description : "Should never change",
fileName : "channel-prefs.js",
relPathDir : "a/b/defaults/pref/",
originalContents : "ShouldNotBeReplaced\n",

Просмотреть файл

@ -11,8 +11,7 @@ const TEST_ID = "0160_svc";
// operations located in the precomplete file performed first.
const TEST_FILES = [
{
description : "Only added by update.manifest for complete updates " +
"when there is a channel change (add-cc)",
description : "Should never change",
fileName : "channel-prefs.js",
relPathDir : "a/b/defaults/pref/",
originalContents : "ShouldNotBeReplaced\n",

Просмотреть файл

@ -11,8 +11,7 @@ const TEST_ID = "0170_svc";
// operations located in the precomplete file performed first.
const TEST_FILES = [
{
description : "Only added by update.manifest for complete updates " +
"when there is a channel change (add-cc)",
description : "Should never change",
fileName : "channel-prefs.js",
relPathDir : "a/b/defaults/pref/",
originalContents : "ShouldNotBeReplaced\n",

Просмотреть файл

@ -11,8 +11,7 @@ const TEST_ID = "0171_svc";
// operations located in the precomplete file performed first.
const TEST_FILES = [
{
description : "Only added by update.manifest for complete updates " +
"when there is a channel change (add-cc)",
description : "Should never change",
fileName : "channel-prefs.js",
relPathDir : "a/b/defaults/pref/",
originalContents : "ShouldNotBeReplaced\n",

Просмотреть файл

@ -11,8 +11,7 @@ const TEST_ID = "0180_svc";
// operations located in the precomplete file performed first.
const TEST_FILES = [
{
description : "Only added by update.manifest for complete updates " +
"when there is a channel change (add-cc)",
description : "Should never change",
fileName : "channel-prefs.js",
relPathDir : "a/b/defaults/pref/",
originalContents : "ShouldNotBeReplaced\n",

Просмотреть файл

@ -12,8 +12,7 @@ const MAR_IN_USE_WIN_FILE = "data/partial_win.mar";
// operations located in the precomplete file performed first.
const TEST_FILES = [
{
description : "Only added by update.manifest for complete updates " +
"when there is a channel change (add-cc)",
description : "Should never change",
fileName : "channel-prefs.js",
relPathDir : "a/b/defaults/pref/",
originalContents : "ShouldNotBeReplaced\n",

Просмотреть файл

@ -11,8 +11,7 @@ const TEST_ID = "0182_svc";
// operations located in the precomplete file performed first.
const TEST_FILES = [
{
description : "Only added by update.manifest for complete updates " +
"when there is a channel change (add-cc)",
description : "Should never change",
fileName : "channel-prefs.js",
relPathDir : "a/b/defaults/pref/",
originalContents : "ShouldNotBeReplaced\n",

Просмотреть файл

@ -12,8 +12,7 @@ const MAR_IN_USE_WIN_FILE = "data/partial.mar";
// operations located in the precomplete file performed first.
const TEST_FILES = [
{
description : "Only added by update.manifest for complete updates " +
"when there is a channel change (add-cc)",
description : "Should never change",
fileName : "channel-prefs.js",
relPathDir : "a/b/defaults/pref/",
originalContents : "ShouldNotBeReplaced\n",

Просмотреть файл

@ -6,7 +6,6 @@ tail =
[test_0110_general_svc.js]
[test_0111_general_svc.js]
[test_0112_general_svc.js]
[test_0120_channelChange_complete_svc.js]
[test_0150_appBinReplaced_xp_win_complete_svc.js]
[test_0151_appBinPatched_xp_win_partial_svc.js]
[test_0160_appInUse_xp_win_complete_svc.js]

Просмотреть файл

@ -54,20 +54,16 @@
*
* updatev2.manifest
* -----------------
* method = "add" | "add-cc" | "add-if" | "patch" | "patch-if" | "remove" |
* method = "add" | "add-if" | "patch" | "patch-if" | "remove" |
* "rmdir" | "rmrfdir" | type
*
* 'add-cc' is an add action to perform on channel change.
*
* 'type' is the update type (e.g. complete or partial) and when present MUST
* be the first entry in the update manifest. The type is used to support
* downgrades by causing the actions defined in precomplete to be performed.
*
* precomplete
* -----------
* method = "remove" | "rmdir" | "remove-cc"
*
* 'remove-cc' is a remove action to perform on channel change.
* method = "remove" | "rmdir"
*/
#include "bspatch.h"
#include "progressui.h"
@ -2440,13 +2436,12 @@ GetManifestContents(const NS_tchar *manifest)
#endif
}
int AddPreCompleteActions(ActionList *list, bool &isChannelChange)
int AddPreCompleteActions(ActionList *list)
{
NS_tchar *rb = GetManifestContents(NS_T("precomplete"));
if (rb == NULL) {
LOG(("AddPreCompleteActions: error getting contents of precomplete " \
"manifest\n"));
isChannelChange = false;
// Applications aren't required to have a precomplete manifest yet.
return OK;
}
@ -2468,11 +2463,8 @@ int AddPreCompleteActions(ActionList *list, bool &isChannelChange)
if (NS_tstrcmp(token, NS_T("remove")) == 0) { // rm file
action = new RemoveFile();
}
else if (NS_tstrcmp(token, NS_T("remove-cc")) == 0) { // rm file
if (!isChannelChange)
continue;
action = new RemoveFile();
else if (NS_tstrcmp(token, NS_T("remove-cc")) == 0) { // no longer supported
continue;
}
else if (NS_tstrcmp(token, NS_T("rmdir")) == 0) { // rmdir if empty
action = new RemoveDir();
@ -2497,15 +2489,6 @@ int AddPreCompleteActions(ActionList *list, bool &isChannelChange)
int DoUpdate()
{
bool isChannelChange = false;
NS_tchar ccfile[MAXPATHLEN];
NS_tsnprintf(ccfile, sizeof(ccfile)/sizeof(ccfile[0]),
NS_T("%s/channelchange"), gSourcePath);
if (!NS_taccess(ccfile, F_OK)) {
LOG(("DoUpdate: changing update channel\n"));
isChannelChange = true;
}
NS_tchar manifest[MAXPATHLEN];
NS_tsnprintf(manifest, sizeof(manifest)/sizeof(manifest[0]),
NS_T("%s/update.manifest"), gSourcePath);
@ -2513,8 +2496,6 @@ int DoUpdate()
// extract the manifest
int rv = gArchiveReader.ExtractFile("updatev2.manifest", manifest);
if (rv) {
// Don't allow changing the channel without a version 2 update manifest.
isChannelChange = false;
rv = gArchiveReader.ExtractFile("update.manifest", manifest);
if (rv) {
LOG(("DoUpdate: error extracting manifest file\n"));
@ -2550,14 +2531,10 @@ int DoUpdate()
LOG(("UPDATE TYPE " LOG_S "\n", type));
if (NS_tstrcmp(type, NS_T("complete")) == 0) {
isComplete = true;
rv = AddPreCompleteActions(&list, isChannelChange);
rv = AddPreCompleteActions(&list);
if (rv)
return rv;
}
else if (isChannelChange) {
LOG(("DoUpdate: unable to change channel with a partial update\n"));
isChannelChange = false;
}
isFirstAction = false;
continue;
}
@ -2597,19 +2574,8 @@ int DoUpdate()
else if (NS_tstrcmp(token, NS_T("patch-if")) == 0) { // Patch if exists
action = new PatchIfFile();
}
else if (NS_tstrcmp(token, NS_T("add-cc")) == 0) { // Add if channel change
// The channel should only be changed with a complete update and when the
// user requests a channel change to avoid overwriting the update channel
// when testing RC's.
// add-cc instructions should only be in complete update manifests.
if (!isComplete)
return PARSE_ERROR;
if (!isChannelChange)
continue;
action = new AddFile();
else if (NS_tstrcmp(token, NS_T("add-cc")) == 0) { // no longer supported
continue;
}
else {
LOG(("DoUpdate: unknown token: " LOG_S "\n", token));

Просмотреть файл

@ -216,12 +216,6 @@ GetVersionFile(nsIFile *dir, nsCOMPtr<nsILocalFile> &result)
return GetFile(dir, NS_LITERAL_CSTRING("update.version"), result);
}
static bool
GetChannelChangeFile(nsIFile *dir, nsCOMPtr<nsILocalFile> &result)
{
return GetFile(dir, NS_LITERAL_CSTRING("channelchange"), result);
}
// Compares the current application version with the update's application
// version.
static bool
@ -539,13 +533,11 @@ ProcessUpdates(nsIFile *greDir, nsIFile *appDir, nsIFile *updRootDir,
if (GetStatusFile(updatesDir, statusFile) &&
IsPending(statusFile)) {
nsCOMPtr<nsILocalFile> versionFile;
nsCOMPtr<nsILocalFile> channelChangeFile;
// Remove the update if the update application version file doesn't exist
// or if the update's application version is less than the current
// application version.
if (!GetChannelChangeFile(updatesDir, channelChangeFile) &&
(!GetVersionFile(updatesDir, versionFile) ||
IsOlderVersion(versionFile, appVersion))) {
if (!GetVersionFile(updatesDir, versionFile) ||
IsOlderVersion(versionFile, appVersion)) {
updatesDir->Remove(true);
} else {
ApplyUpdate(greDir, updatesDir, statusFile, appDir,