Bug 1524407 - Cleanup of unused and unnecessary code in nsUpdateDriver.cpp. r=mhowell
authorRobert Strong <robert.bugzilla@gmail.com>
Thu, 31 Jan 2019 22:28:50 -0800
changeset 456398 648e0d2c5ef838186b7a4f688cf5568fea4829bb
parent 456397 5f53c5571125b1c05187ceeaef7d21c30608e5b3
child 456399 e565291ee5f6c863a5e247c078f0358142fb0062
push id19
push usermdeboer@mozilla.com
push dateFri, 01 Feb 2019 10:05:45 +0000
reviewersmhowell
bugs1524407
milestone67.0a1
Bug 1524407 - Cleanup of unused and unnecessary code in nsUpdateDriver.cpp. r=mhowell
toolkit/mozapps/update/nsIUpdateService.idl
toolkit/mozapps/update/nsUpdateService.js
toolkit/mozapps/update/tests/data/xpcshellUtilsAUS.js
toolkit/xre/nsUpdateDriver.cpp
toolkit/xre/nsUpdateDriver.h
--- a/toolkit/mozapps/update/nsIUpdateService.idl
+++ b/toolkit/mozapps/update/nsIUpdateService.idl
@@ -394,24 +394,19 @@ interface nsIApplicationUpdateService : 
 /**
  * An interface describing a component which handles the job of processing
  * an update after it's been downloaded.
  */
 [scriptable, uuid(74439497-d796-4915-8cef-3dfe43027e4d)]
 interface nsIUpdateProcessor : nsISupports
 {
   /**
-   * Processes the update which has been downloaded.
-   * This happens without restarting the application.
-   * On Windows, this can also be used for switching to an applied
-   * update request.
-   * @param update The update being applied, or null if this is a switch
-   *               to updated application request.
+   * Stages an update while the application is running.
    */
-  void processUpdate(in nsIUpdate update);
+  void processUpdate();
 
   /**
    * Attempts to fix the permissions of the update directory. This can be done
    * in two ways. Firefox can attempt to fix the permissions itself, or it can
    * call into the maintenance service to request that it attempt to fix the
    * permissions.
    *
    * Fixing the permissions can take some time, so this work is all done off of
--- a/toolkit/mozapps/update/nsUpdateService.js
+++ b/toolkit/mozapps/update/nsUpdateService.js
@@ -4006,18 +4006,17 @@ Downloader.prototype = {
         state == STATE_PENDING_ELEVATE) {
       if (getCanStageUpdates()) {
         LOG("Downloader:onStopRequest - attempting to stage update: " +
             this._update.name);
         gUpdateFileWriteInfo = {phase: "stage", failure: false};
         // Stage the update
         try {
           Cc["@mozilla.org/updates/update-processor;1"].
-            createInstance(Ci.nsIUpdateProcessor).
-            processUpdate(this._update);
+            createInstance(Ci.nsIUpdateProcessor).processUpdate();
         } catch (e) {
           // Fail gracefully in case the application does not support the update
           // processor service.
           LOG("Downloader:onStopRequest - failed to stage update. Exception: " +
               e);
           if (this.background) {
             shouldShowPrompt = true;
           }
--- a/toolkit/mozapps/update/tests/data/xpcshellUtilsAUS.js
+++ b/toolkit/mozapps/update/tests/data/xpcshellUtilsAUS.js
@@ -2075,18 +2075,17 @@ function stageUpdate(aCheckSvcLog) {
 
   Services.obs.addObserver(gUpdateStagedObserver, "update-staged");
 
   setAppBundleModTime();
   setEnvironment();
   try {
     // Stage the update.
     Cc["@mozilla.org/updates/update-processor;1"].
-      createInstance(Ci.nsIUpdateProcessor).
-      processUpdate(gUpdateManager.activeUpdate);
+      createInstance(Ci.nsIUpdateProcessor).processUpdate();
   } catch (e) {
     Assert.ok(false,
               "error thrown while calling processUpdate, exception: " + e);
   }
 
   // The environment is not reset here because processUpdate in
   // nsIUpdateProcessor uses a new thread and clearing the environment
   // immediately after calling processUpdate can clear the environment before
--- a/toolkit/xre/nsUpdateDriver.cpp
+++ b/toolkit/xre/nsUpdateDriver.cpp
@@ -783,17 +783,17 @@ nsresult ProcessUpdates(nsIFile *greDir,
 
 NS_IMPL_ISUPPORTS(nsUpdateProcessor, nsIUpdateProcessor)
 
 nsUpdateProcessor::nsUpdateProcessor() : mUpdaterPID(0) {}
 
 nsUpdateProcessor::~nsUpdateProcessor() {}
 
 NS_IMETHODIMP
-nsUpdateProcessor::ProcessUpdate(nsIUpdate *aUpdate) {
+nsUpdateProcessor::ProcessUpdate() {
   nsresult rv;
 
   nsCOMPtr<nsIProperties> ds =
       do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID, &rv);
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsCOMPtr<nsIFile> exeFile;
   rv = ds->Get(XRE_EXECUTABLE_FILE, NS_GET_IID(nsIFile),
--- a/toolkit/xre/nsUpdateDriver.h
+++ b/toolkit/xre/nsUpdateDriver.h
@@ -60,32 +60,30 @@ class nsUpdateProcessor final : public n
 
   NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSIUPDATEPROCESSOR
 
  private:
   ~nsUpdateProcessor();
 
   struct StagedUpdateInfo {
-    StagedUpdateInfo() : mArgc(0), mArgv(nullptr), mIsOSUpdate(false) {}
+    StagedUpdateInfo() : mArgc(0), mArgv(nullptr) {}
     ~StagedUpdateInfo() {
       for (int i = 0; i < mArgc; ++i) {
         delete[] mArgv[i];
       }
       delete[] mArgv;
     }
 
     nsCOMPtr<nsIFile> mGREDir;
     nsCOMPtr<nsIFile> mAppDir;
     nsCOMPtr<nsIFile> mUpdateRoot;
-    nsCOMPtr<nsIFile> mOSApplyToDir;
     int mArgc;
     char **mArgv;
     nsCString mAppVersion;
-    bool mIsOSUpdate;
   };
 
  private:
   void StartStagedUpdate();
   void WaitForProcess();
   void UpdateDone();
   void ShutdownWatcherThread();