Bug 947585 - Return result when get OS apply dir failed. r=marshall
authorKai-Zhen Li <kli@mozilla.com>
Mon, 09 Dec 2013 14:10:08 +0800
changeset 163123 e96fa95f3e219e78c0349045ed981ef36297d737
parent 163122 4546a3b6c2b0c05c808e4ef91032725079beb6a5
child 163124 bbc7ef6e8fbacfee8bf4b1aa310763995638b759
push id25982
push userryanvm@gmail.com
push dateMon, 13 Jan 2014 22:30:39 +0000
treeherdermozilla-central@d524c4b2cbb8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmarshall
bugs947585
milestone29.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 947585 - Return result when get OS apply dir failed. r=marshall
toolkit/xre/nsUpdateDriver.cpp
--- a/toolkit/xre/nsUpdateDriver.cpp
+++ b/toolkit/xre/nsUpdateDriver.cpp
@@ -601,19 +601,22 @@ SwitchToUpdatedApp(nsIFile *greDir, nsIF
 static nsresult
 GetOSApplyToDir(nsACString& applyToDir)
 {
   nsCOMPtr<nsIProperties> ds =
     do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID);
   NS_ASSERTION(ds, "Can't get directory service");
 
   nsCOMPtr<nsIFile> osApplyToDir;
-  DebugOnly<nsresult> rv = ds->Get(XRE_OS_UPDATE_APPLY_TO_DIR, NS_GET_IID(nsIFile),
+  nsresult rv = ds->Get(XRE_OS_UPDATE_APPLY_TO_DIR, NS_GET_IID(nsIFile),
                                    getter_AddRefs(osApplyToDir));
-  NS_ASSERTION(NS_SUCCEEDED(rv), "Can't get the OS applyTo dir");
+  if (NS_FAILED(rv)) {
+    LOG(("Can't get the OS applyTo dir"));
+    return rv;
+  }
 
   return osApplyToDir->GetNativePath(applyToDir);
 }
 
 static void
 SetOSApplyToDir(nsIUpdate* update, const nsACString& osApplyToDir)
 {
   nsresult rv;
@@ -1135,24 +1138,30 @@ nsUpdateProcessor::ProcessUpdate(nsIUpda
   bool isOSUpdate;
   if (NS_SUCCEEDED(aUpdate->GetIsOSUpdate(&isOSUpdate)) &&
       isOSUpdate) {
     nsAutoCString osApplyToDir;
 
     // This needs to be done on the main thread, so we pass it along in
     // BackgroundThreadInfo
     nsresult rv = GetOSApplyToDir(osApplyToDir);
-    NS_ASSERTION(NS_SUCCEEDED(rv), "Can't get the OS apply to dir");
+    if (NS_FAILED(rv)) {
+      LOG(("Can't get the OS apply to dir"));
+      return rv;
+    }
 
     SetOSApplyToDir(aUpdate, osApplyToDir);
 
     mInfo.mIsOSUpdate = true;
     rv = NS_NewNativeLocalFile(osApplyToDir, false,
                                getter_AddRefs(mInfo.mOSApplyToDir));
-    NS_ASSERTION(NS_SUCCEEDED(rv), "Can't create nsIFile for OS apply to dir");
+    if (NS_FAILED(rv)) {
+      LOG(("Can't create nsIFile for OS apply to dir"));
+      return rv;
+    }
   }
 #endif
 
   mUpdate = aUpdate;
 
   NS_ABORT_IF_FALSE(NS_IsMainThread(), "not main thread");
   return NS_NewThread(getter_AddRefs(mProcessWatcher),
                       NS_NewRunnableMethod(this, &nsUpdateProcessor::StartBackgroundUpdate));