Backed out changeset 3ac2c898f94f (bug 1403366) for failing xpcshell tests netwerk/test/httpserver/test/test_basic_functionality.js and test_bug337744.js. r=backout
authorSebastian Hengst <archaeopteryx@coole-files.de>
Fri, 29 Sep 2017 17:21:29 +0200
changeset 383769 aa0a7cd0d56a755422f7ca2592ed370b0f347ffb
parent 383768 8d60c66e11b70e77b723bbb9699ef2eaa5c5eb1b
child 383770 d394ed31deb48572df7ec2b18eaa6e273bf807f7
push id52370
push userarchaeopteryx@coole-files.de
push dateFri, 29 Sep 2017 15:22:58 +0000
treeherderautoland@aa0a7cd0d56a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbackout
bugs1403366, 337744
milestone58.0a1
backs out3ac2c898f94f4ff40bfe837eabf10bb2140a25cd
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
Backed out changeset 3ac2c898f94f (bug 1403366) for failing xpcshell tests netwerk/test/httpserver/test/test_basic_functionality.js and test_bug337744.js. r=backout
xpcom/io/nsDirectoryService.cpp
--- a/xpcom/io/nsDirectoryService.cpp
+++ b/xpcom/io/nsDirectoryService.cpp
@@ -60,22 +60,34 @@ nsDirectoryService::GetCurrentProcessDir
   }
   *aFile = nullptr;
 
   //  Set the component registry location:
   if (!gService) {
     return NS_ERROR_FAILURE;
   }
 
-  nsCOMPtr<nsIFile> file;
-  gService->Get(NS_XPCOM_INIT_CURRENT_PROCESS_DIR, NS_GET_IID(nsIFile),
-                getter_AddRefs(file));
-  if (file) {
-    file.forget(aFile);
-    return NS_OK;
+  nsresult rv;
+
+  nsCOMPtr<nsIProperties> dirService;
+  rv = nsDirectoryService::Create(nullptr,
+                                  NS_GET_IID(nsIProperties),
+                                  getter_AddRefs(dirService));  // needs to be around for life of product
+  if (NS_FAILED(rv)) {
+    return rv;
+  }
+
+  if (dirService) {
+    nsCOMPtr<nsIFile> localFile;
+    dirService->Get(NS_XPCOM_INIT_CURRENT_PROCESS_DIR, NS_GET_IID(nsIFile),
+                    getter_AddRefs(localFile));
+    if (localFile) {
+      localFile.forget(aFile);
+      return NS_OK;
+    }
   }
 
   RefPtr<nsLocalFile> localFile = new nsLocalFile;
 
 #ifdef XP_WIN
   wchar_t buf[MAX_PATH + 1];
   SetLastError(ERROR_SUCCESS);
   if (GetModuleFileNameW(0, buf, mozilla::ArrayLength(buf)) &&
@@ -104,17 +116,17 @@ nsDirectoryService::GetCurrentProcessDir
         // This will resolve the relative portion of the CFURL against it base, giving a full
         // path, which CFURLCopyFileSystemPath doesn't do.
         char buffer[PATH_MAX];
         if (CFURLGetFileSystemRepresentation(parentURL, true,
                                              (UInt8*)buffer, sizeof(buffer))) {
 #ifdef DEBUG_conrad
           printf("nsDirectoryService - CurrentProcessDir is: %s\n", buffer);
 #endif
-          nsresult rv = localFile->InitWithNativePath(nsDependentCString(buffer));
+          rv = localFile->InitWithNativePath(nsDependentCString(buffer));
           if (NS_SUCCEEDED(rv)) {
             localFile.forget(aFile);
           }
         }
         CFRelease(parentURL);
       }
       CFRelease(bundleURL);
     }