Bug 620931 part 4 - Fix resource://app/ to always point to the same as resource:///. r=bsmedberg
☠☠ backed out by 941d126f6dd2 ☠ ☠
authorMike Hommey <mh+mozilla@glandium.org>
Thu, 24 Mar 2011 15:28:31 +0100
changeset 63726 9df6e8117fe03393d39e489e3ee2462f08735ab7
parent 63725 b9e6454362ef8a051ec8feb557fb2e2e4071c95e
child 63727 b97a060746f995e095e3f4c86e56af26b0ae9c75
push idunknown
push userunknown
push dateunknown
reviewersbsmedberg
bugs620931
milestone2.2a1pre
Bug 620931 part 4 - Fix resource://app/ to always point to the same as resource:///. r=bsmedberg
netwerk/protocol/res/nsResProtocolHandler.cpp
toolkit/xre/nsXREDirProvider.cpp
--- a/netwerk/protocol/res/nsResProtocolHandler.cpp
+++ b/netwerk/protocol/res/nsResProtocolHandler.cpp
@@ -74,16 +74,17 @@ static nsResProtocolHandler *gResHandler
 //    set NSPR_LOG_FILE=log.txt
 //
 // this enables PR_LOG_ALWAYS level information and places all output in
 // the file log.txt
 //
 static PRLogModuleInfo *gResLog;
 #endif
 
+#define kAPP           NS_LITERAL_CSTRING("app")
 #define kGRE           NS_LITERAL_CSTRING("gre")
 
 //----------------------------------------------------------------------------
 // nsResURL : overrides nsStandardURL::GetFile to provide nsIFile resolution
 //----------------------------------------------------------------------------
 
 nsresult
 nsResURL::EnsureFile()
@@ -179,16 +180,22 @@ nsResProtocolHandler::Init()
     nsCOMPtr<nsIURI> uri;
     rv = NS_NewURI(getter_AddRefs(uri), appURI.Length() ? appURI : greURI);
     NS_ENSURE_SUCCESS(rv, rv);
 
     rv = SetSubstitution(EmptyCString(), uri);
     NS_ENSURE_SUCCESS(rv, rv);
 
     //
+    // make resource://app/ point to the application directory or omnijar
+    //
+    rv = SetSubstitution(kAPP, uri);
+    NS_ENSURE_SUCCESS(rv, rv);
+
+    //
     // make resource://gre/ point to the GRE directory
     //
     if (appURI.Length()) { // We already have greURI in uri if appURI.Length() is 0.
         rv = NS_NewURI(getter_AddRefs(uri), greURI);
         NS_ENSURE_SUCCESS(rv, rv);
     }
 
     rv = SetSubstitution(kGRE, uri);
--- a/toolkit/xre/nsXREDirProvider.cpp
+++ b/toolkit/xre/nsXREDirProvider.cpp
@@ -296,19 +296,16 @@ nsXREDirProvider::GetFile(const char* aP
     }
   }
   else if (!strcmp(aProperty, XRE_EXECUTABLE_FILE) && gArgv[0]) {
     nsCOMPtr<nsILocalFile> lf;
     rv = XRE_GetBinaryPath(gArgv[0], getter_AddRefs(lf));
     if (NS_SUCCEEDED(rv))
       file = lf;
   }
-  else if (!strcmp(aProperty, "resource:app")) {
-    rv = GetAppDir()->Clone(getter_AddRefs(file));
-  }
 
   else if (!strcmp(aProperty, NS_APP_PROFILE_DIR_STARTUP) && mProfileDir) {
     return mProfileDir->Clone(aFile);
   }
   else if (!strcmp(aProperty, NS_APP_PROFILE_LOCAL_DIR_STARTUP)) {
     if (mProfileLocalDir)
       return mProfileLocalDir->Clone(aFile);