@@ -368,8 +368,8 @@ CopyUpdaterIntoUpdateDir(nsIFile *greDir, nsIFile *appDir, nsIFile *updateDir,
368
368
}
369
369
370
370
/* *
371
- * Switch an existing application directory to an updated version which has been
372
- * previously constructed in the background .
371
+ * Switch an existing application directory to an updated version that has been
372
+ * staged .
373
373
*
374
374
* @param greDir the GRE dir
375
375
* @param updateDir the update root dir
@@ -640,7 +640,7 @@ SetOSApplyToDir(nsIUpdate* update, const nsACString& osApplyToDir)
640
640
#endif
641
641
642
642
/* *
643
- * Apply an update, possibly in the background .
643
+ * Apply an update. This applies to both normal and staged updates .
644
644
*
645
645
* @param greDir the GRE dir
646
646
* @param updateDir the update root dir
@@ -649,10 +649,10 @@ SetOSApplyToDir(nsIUpdate* update, const nsACString& osApplyToDir)
649
649
* @param appArgc the number of args to the application
650
650
* @param appArgv the args to the application, used for restarting if needed
651
651
* @param restart if true, apply the update in the foreground and restart the
652
- * application when done. otherwise, apply the update in the
653
- * background and don't restart the application.
652
+ * application when done. otherwise, stage the update and don't
653
+ * restart the application.
654
654
* @param outpid out parameter holding the handle to the updater application for
655
- * background updates.
655
+ * staging updates.
656
656
*/
657
657
static void
658
658
ApplyUpdate (nsIFile *greDir, nsIFile *updateDir, nsIFile *statusFile,
@@ -731,8 +731,7 @@ ApplyUpdate(nsIFile *greDir, nsIFile *updateDir, nsIFile *statusFile,
731
731
if (NS_FAILED(rv))
732
732
return ;
733
733
if (restart) {
734
- // Use the correct directory if we're not applying the update in the
735
- // background.
734
+ // Use the correct directory if we're not staging the update.
736
735
rv = parentDir2->GetNativePath (applyToDir);
737
736
} else {
738
737
if (!GetFile (parentDir2, NS_LITERAL_CSTRING(" Updated.app" ), updatedDir))
@@ -742,8 +741,7 @@ ApplyUpdate(nsIFile *greDir, nsIFile *updateDir, nsIFile *statusFile,
742
741
}
743
742
#else
744
743
if (restart) {
745
- // Use the correct directory if we're not applying the update in the
746
- // background.
744
+ // Use the correct directory if we're not staging the update.
747
745
updatedDir = do_QueryInterface (appDir);
748
746
} else if (!GetFile (appDir, NS_LITERAL_CSTRING(" updated" ), updatedDir)) {
749
747
return ;
@@ -807,8 +805,7 @@ ApplyUpdate(nsIFile *greDir, nsIFile *updateDir, nsIFile *statusFile,
807
805
// we pass "0" which is then ignored by the updater.
808
806
nsAutoCString pid;
809
807
if (!restart) {
810
- // Signal the updater application that it should apply the update in the
811
- // background.
808
+ // Signal the updater application that it should stage the update.
812
809
pid.AssignASCII (" -1" );
813
810
} else {
814
811
#if defined(USE_EXECV)
@@ -876,7 +873,7 @@ ApplyUpdate(nsIFile *greDir, nsIFile *updateDir, nsIFile *statusFile,
876
873
LOG ((" spawning updater process [%s]\n " , updaterPath.get ()));
877
874
878
875
#if defined(USE_EXECV)
879
- // Don't use execv for background updates.
876
+ // Don't use execv when staging updates.
880
877
if (restart) {
881
878
execv (updaterPath.get (), argv);
882
879
} else {
@@ -950,34 +947,12 @@ ProcessUpdates(nsIFile *greDir, nsIFile *appDir, nsIFile *updRootDir,
950
947
if (NS_FAILED(rv))
951
948
return rv;
952
949
953
- ProcessType dummyPID; // this will only be used for MOZ_UPDATE_BACKGROUND
950
+ ProcessType dummyPID; // this will only be used for MOZ_UPDATE_STAGING
954
951
const char *processingUpdates = PR_GetEnv (" MOZ_PROCESS_UPDATES" );
955
952
if (processingUpdates && *processingUpdates) {
956
- // Enable the tests to request us to use a different update root directory
957
- const char *updRootOverride = PR_GetEnv (" MOZ_UPDATE_ROOT_OVERRIDE" );
958
- if (updRootOverride && *updRootOverride) {
959
- nsCOMPtr<nsIFile> overrideDir;
960
- nsAutoCString path (updRootOverride);
961
- rv = NS_NewNativeLocalFile(path, false , getter_AddRefs (overrideDir));
962
- if (NS_FAILED(rv)) {
963
- return rv;
964
- }
965
- updatesDir = do_QueryInterface (overrideDir);
966
- }
967
- // Enable the tests to request us to use a different app directory
968
- const char *appDirOverride = PR_GetEnv (" MOZ_UPDATE_APPDIR_OVERRIDE" );
969
- if (appDirOverride && *appDirOverride) {
970
- nsCOMPtr<nsIFile> overrideDir;
971
- nsAutoCString path (appDirOverride);
972
- rv = NS_NewNativeLocalFile(path, false , getter_AddRefs (overrideDir));
973
- if (NS_FAILED(rv)) {
974
- return rv;
975
- }
976
- NS_ADDREF (appDir = overrideDir);
977
- }
978
- // Enable the tests to request us to perform a background update
979
- const char *backgroundUpdate = PR_GetEnv (" MOZ_UPDATE_BACKGROUND" );
980
- if (backgroundUpdate && *backgroundUpdate) {
953
+ // Enable the tests to request an update to be staged.
954
+ const char *stagingUpdate = PR_GetEnv (" MOZ_UPDATE_STAGING" );
955
+ if (stagingUpdate && *stagingUpdate) {
981
956
restart = false ;
982
957
pid = &dummyPID;
983
958
}
@@ -1003,8 +978,8 @@ ProcessUpdates(nsIFile *greDir, nsIFile *appDir, nsIFile *updRootDir,
1003
978
}
1004
979
case eAppliedUpdate:
1005
980
case eAppliedService:
1006
- // An update was applied in the background, so we need to switch to using
1007
- // it now .
981
+ // An update was staged and needs to be switched so the updated application
982
+ // is used .
1008
983
SwitchToUpdatedApp (greDir, updatesDir, statusFile,
1009
984
appDir, argc, argv);
1010
985
break ;
@@ -1108,7 +1083,7 @@ nsUpdateProcessor::ProcessUpdate(nsIUpdate* aUpdate)
1108
1083
binary->GetNativePath (binPath);
1109
1084
}
1110
1085
1111
- // Copy the parameters to the BackgroundUpdateInfo structure shared with the
1086
+ // Copy the parameters to the StagedUpdateInfo structure shared with the
1112
1087
// watcher thread.
1113
1088
mInfo .mGREDir = greDir;
1114
1089
mInfo .mAppDir = appDir;
@@ -1155,13 +1130,13 @@ nsUpdateProcessor::ProcessUpdate(nsIUpdate* aUpdate)
1155
1130
1156
1131
NS_ABORT_IF_FALSE (NS_IsMainThread(), "not main thread");
1157
1132
return NS_NewThread(getter_AddRefs (mProcessWatcher ),
1158
- NS_NewRunnableMethod (this , &nsUpdateProcessor::StartBackgroundUpdate ));
1133
+ NS_NewRunnableMethod (this , &nsUpdateProcessor::StartStagedUpdate ));
1159
1134
}
1160
1135
1161
1136
1162
1137
1163
1138
void
1164
- nsUpdateProcessor::StartBackgroundUpdate ()
1139
+ nsUpdateProcessor::StartStagedUpdate ()
1165
1140
{
1166
1141
NS_ABORT_IF_FALSE (!NS_IsMainThread(), "main thread");
1167
1142
@@ -1178,11 +1153,11 @@ nsUpdateProcessor::StartBackgroundUpdate()
1178
1153
NS_ENSURE_SUCCESS_VOID (rv);
1179
1154
1180
1155
if (mUpdaterPID ) {
1181
- // Track the state of the background updater process
1156
+ // Track the state of the updater process while it is staging an update.
1182
1157
rv = NS_DispatchToCurrentThread(NS_NewRunnableMethod(this , &nsUpdateProcessor::WaitForProcess));
1183
1158
NS_ENSURE_SUCCESS_VOID (rv);
1184
1159
} else {
1185
- // Failed to launch the background updater process for some reason.
1160
+ // Failed to launch the updater process for some reason.
1186
1161
// We need to shutdown the current thread as there isn't anything more for
1187
1162
// us to do...
1188
1163
rv = NS_DispatchToMainThread(NS_NewRunnableMethod(this , &nsUpdateProcessor::ShutdownWatcherThread));
0 commit comments