Bug 760747 - Wrong check in Mac and Windows webapp runtimes; r=myk
authorMarco Castelluccio <mar.castelluccio@studenti.unina.it>
Tue, 12 Jun 2012 13:01:01 -0700
changeset 96512 d7362d197229fadfe94f016139e731f12f4e7acb
parent 96511 8d857c53bc0aebb3d8320da8aa9bcfe1c5027ea7
child 96513 15d7e7cc09a6fb6ee3deb38d460778ecdb8f0b8b
push id22911
push useremorley@mozilla.com
push dateWed, 13 Jun 2012 12:49:30 +0000
treeherdermozilla-central@efbb6480e98e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmyk
bugs760747
milestone16.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 760747 - Wrong check in Mac and Windows webapp runtimes; r=myk
webapprt/mac/webapprt.mm
webapprt/win/webapprt.cpp
--- a/webapprt/mac/webapprt.mm
+++ b/webapprt/mac/webapprt.mm
@@ -218,31 +218,29 @@ main(int argc, char **argv)
         // Get the path to the runtime directory.
         char rtDir[MAXPATHLEN];
         snprintf(rtDir, MAXPATHLEN, "%s%s%s", [firefoxPath UTF8String], APP_CONTENTS_PATH, WEBAPPRT_PATH);
 
         // Get the path to the runtime's INI file.  This is in the runtime
         // directory.
         snprintf(rtINIPath, MAXPATHLEN, "%s%s%s%s", [firefoxPath UTF8String], APP_CONTENTS_PATH, WEBAPPRT_PATH, WEBRTINI_NAME);
         NSLog(@"WebappRT application.ini path: %s", rtINIPath);
-        if (![[NSFileManager defaultManager] fileExistsAtPath:[NSString stringWithFormat:@"%s", rtINIPath]]) {
-          NSString* msg = [NSString stringWithFormat: @"This copy of Firefox (%@) cannot run web applications, because it is missing important files", firefoxVersion];
-          @throw MakeException(@"Missing WebRT Files", msg);
-        }
 
         // Load the runtime's INI from its path.
         nsCOMPtr<nsIFile> rtINI;
         if (NS_FAILED(XRE_GetFileFromPath(rtINIPath, getter_AddRefs(rtINI)))) {
           NSLog(@"Runtime INI path not recognized: '%s'\n", rtINIPath);
           @throw MakeException(@"Error", @"Incorrect path to base INI file.");
         }
 
-        if (!rtINI) {
-          NSLog(@"Error: missing WebappRT application.ini");
-          @throw MakeException(@"Error", @"Missing base INI file.");
+        bool exists;
+        nsresult rv = rtINI->Exists(&exists);
+        if (NS_FAILED(rv) || !exists) {
+          NSString* msg = [NSString stringWithFormat: @"This copy of Firefox (%@) cannot run web applications, because it is missing WebappRT application.ini", firefoxVersion];
+          @throw MakeException(@"Missing WebappRT application.ini", msg);
         }
 
         nsXREAppData *webShellAppData;
         if (NS_FAILED(XRE_CreateAppData(rtINI, &webShellAppData))) {
           NSLog(@"Couldn't read WebappRT application.ini: %s", rtINIPath);
           @throw MakeException(@"Error", @"Unable to parse base INI file.");
         }
 
--- a/webapprt/win/webapprt.cpp
+++ b/webapprt/win/webapprt.cpp
@@ -273,19 +273,20 @@ namespace {
       rv = joinPath(rtIniPath, rtPath, kWEBAPPRT_INI, MAXPATHLEN);
       NS_ENSURE_SUCCESS(rv, false);
 
       // Load the runtime's INI from its path.
       nsCOMPtr<nsIFile> rtINI;
       rv = XRE_GetFileFromPath(rtIniPath, getter_AddRefs(rtINI));
       NS_ENSURE_SUCCESS(rv, false);
 
-      if (!rtINI) {
+      bool exists;
+      rv = rtINI->Exists(&exists);
+      if (NS_FAILED(rv) || !exists)
         return false;
-      }
 
       ScopedXREAppData webShellAppData;
       rv = webShellAppData.create(rtINI);
       NS_ENSURE_SUCCESS(rv, rv);
 
       SetAllocatedString(webShellAppData->profile, profile);
       SetAllocatedString(webShellAppData->name, profile);