Bug 1164292 - Switch nsIPrincipal::origin to ACString. r=gabor
authorBobby Holley <bobbyholley@gmail.com>
Tue, 12 May 2015 15:08:20 -0700
changeset 274887 217e812d233192fe5402f5c885d4d37108f3c524
parent 274886 1f283549fee9060c305c98333fd091c472874898
child 274888 cf20e65c418748d9d066e154b08feee4dfa58a1b
push id4932
push userjlund@mozilla.com
push dateMon, 10 Aug 2015 18:23:06 +0000
treeherdermozilla-beta@6dd5a4f5f745 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgabor
bugs1164292
milestone41.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 1164292 - Switch nsIPrincipal::origin to ACString. r=gabor
caps/nsIPrincipal.idl
caps/nsNullPrincipal.cpp
caps/nsNullPrincipal.h
caps/nsPrincipal.cpp
caps/nsPrincipal.h
caps/nsScriptSecurityManager.cpp
caps/nsSystemPrincipal.cpp
caps/nsSystemPrincipal.h
dom/cache/ManagerId.cpp
dom/cache/PrincipalVerifier.cpp
dom/ipc/ContentParent.cpp
dom/media/MediaManager.cpp
dom/quota/QuotaManager.cpp
extensions/cookie/nsPermissionManager.cpp
netwerk/ipc/NeckoParent.cpp
netwerk/protocol/app/AppProtocolHandler.cpp
--- a/caps/nsIPrincipal.idl
+++ b/caps/nsIPrincipal.idl
@@ -15,17 +15,17 @@ struct JSPrincipals;
 
 interface nsIURI;
 interface nsIContentSecurityPolicy;
 
 [ptr] native JSContext(JSContext);
 [ptr] native JSPrincipals(JSPrincipals);
 [ptr] native PrincipalArray(nsTArray<nsCOMPtr<nsIPrincipal> >);
 
-[scriptable, builtinclass, uuid(264fe8ca-c382-11e4-95a6-782bcbaebb28)]
+[scriptable, builtinclass, uuid(7e024afa-afd4-48e7-ba11-1c7b9620b1b2)]
 interface nsIPrincipal : nsISerializable
 {
     /**
      * Returns whether the other principal is equivalent to this principal.
      * Principals are considered equal if they are the same principal, or
      * they have the same origin.
      */
     boolean equals(in nsIPrincipal other);
@@ -67,17 +67,17 @@ interface nsIPrincipal : nsISerializable
 
     /**
      * The origin of this principal's codebase URI.
      * An origin is defined as: scheme + host + port.
      */
     // XXXcaa this should probably be turned into an nsIURI.
     // The system principal's origin should be some caps namespace
     // with a chrome URI.  All of chrome should probably be the same.
-    readonly attribute string origin;
+    readonly attribute ACString origin;
 
     /**
      * Returns whether the other principal is equal to or weaker than this
      * principal. Principals are equal if they are the same object or they
      * have the same origin.
      *
      * Thus a principal always subsumes itself.
      *
--- a/caps/nsNullPrincipal.cpp
+++ b/caps/nsNullPrincipal.cpp
@@ -116,29 +116,20 @@ nsNullPrincipal::GetDomain(nsIURI** aDom
 NS_IMETHODIMP
 nsNullPrincipal::SetDomain(nsIURI* aDomain)
 {
   // I think the right thing to do here is to just throw...  Silently failing
   // seems counterproductive.
   return NS_ERROR_NOT_AVAILABLE;
 }
 
-NS_IMETHODIMP 
-nsNullPrincipal::GetOrigin(char** aOrigin)
+NS_IMETHODIMP
+nsNullPrincipal::GetOrigin(nsACString& aOrigin)
 {
-  *aOrigin = nullptr;
-  
-  nsAutoCString str;
-  nsresult rv = mURI->GetSpec(str);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  *aOrigin = ToNewCString(str);
-  NS_ENSURE_TRUE(*aOrigin, NS_ERROR_OUT_OF_MEMORY);
-
-  return NS_OK;
+  return mURI->GetSpec(aOrigin);
 }
 
 NS_IMETHODIMP
 nsNullPrincipal::Subsumes(nsIPrincipal *aOther, bool *aResult)
 {
   // We don't subsume anything except ourselves.  Note that nsPrincipal::Equals
   // will return false for us, since we're not about:blank and not Equals to
   // reasonable nsPrincipals.
--- a/caps/nsNullPrincipal.h
+++ b/caps/nsNullPrincipal.h
@@ -41,17 +41,17 @@ public:
 
   NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr) override;
   NS_IMETHOD Equals(nsIPrincipal* other, bool* _retval) override;
   NS_IMETHOD EqualsConsideringDomain(nsIPrincipal* other, bool* _retval) override;
   NS_IMETHOD GetHashValue(uint32_t* aHashValue) override;
   NS_IMETHOD GetURI(nsIURI** aURI) override;
   NS_IMETHOD GetDomain(nsIURI** aDomain) override;
   NS_IMETHOD SetDomain(nsIURI* aDomain) override;
-  NS_IMETHOD GetOrigin(char** aOrigin) override;
+  NS_IMETHOD GetOrigin(nsACString& aOrigin) override;
   NS_IMETHOD Subsumes(nsIPrincipal* other, bool* _retval) override;
   NS_IMETHOD SubsumesConsideringDomain(nsIPrincipal* other, bool* _retval) override;
   NS_IMETHOD CheckMayLoad(nsIURI* uri, bool report, bool allowIfInheritsPrincipal) override;
   NS_IMETHOD GetJarPrefix(nsACString& aJarPrefix) override;
   NS_IMETHOD GetAppStatus(uint16_t* aAppStatus) override;
   NS_IMETHOD GetAppId(uint32_t* aAppStatus) override;
   NS_IMETHOD GetIsInBrowserElement(bool* aIsInBrowserElement) override;
   NS_IMETHOD GetUnknownAppId(bool* aUnknownAppId) override;
--- a/caps/nsPrincipal.cpp
+++ b/caps/nsPrincipal.cpp
@@ -100,24 +100,22 @@ nsPrincipal::Init(nsIURI *aCodebase,
 
 void
 nsPrincipal::GetScriptLocation(nsACString &aStr)
 {
   mCodebase->GetSpec(aStr);
 }
 
 /* static */ nsresult
-nsPrincipal::GetOriginForURI(nsIURI* aURI, char **aOrigin)
+nsPrincipal::GetOriginForURI(nsIURI* aURI, nsACString& aOrigin)
 {
   if (!aURI) {
     return NS_ERROR_FAILURE;
   }
 
-  *aOrigin = nullptr;
-
   nsCOMPtr<nsIURI> origin = NS_GetInnermostURI(aURI);
   if (!origin) {
     return NS_ERROR_FAILURE;
   }
 
   nsAutoCString hostPort;
 
   // chrome: URLs don't have a meaningful origin, so make
@@ -141,39 +139,31 @@ nsPrincipal::GetOriginForURI(nsIURI* aUR
   }
 
   if (NS_SUCCEEDED(rv) && !isChrome) {
     if (port != -1) {
       hostPort.Append(':');
       hostPort.AppendInt(port, 10);
     }
 
-    nsAutoCString scheme;
-    rv = origin->GetScheme(scheme);
+    rv = origin->GetScheme(aOrigin);
     NS_ENSURE_SUCCESS(rv, rv);
-
-    *aOrigin = ToNewCString(scheme + NS_LITERAL_CSTRING("://") + hostPort);
+    aOrigin.AppendLiteral("://");
+    aOrigin.Append(hostPort);
   }
   else {
-    // Some URIs (e.g., nsSimpleURI) don't support asciiHost. Just
-    // get the full spec.
-    nsAutoCString spec;
-    // XXX nsMozIconURI and nsJARURI don't implement this correctly, they
-    // both fall back to GetSpec.  That needs to be fixed.
-    rv = origin->GetAsciiSpec(spec);
+    rv = origin->GetAsciiSpec(aOrigin);
     NS_ENSURE_SUCCESS(rv, rv);
-
-    *aOrigin = ToNewCString(spec);
   }
 
-  return *aOrigin ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
+  return NS_OK;
 }
 
 NS_IMETHODIMP
-nsPrincipal::GetOrigin(char **aOrigin)
+nsPrincipal::GetOrigin(nsACString& aOrigin)
 {
   return GetOriginForURI(mCodebase, aOrigin);
 }
 
 NS_IMETHODIMP
 nsPrincipal::EqualsConsideringDomain(nsIPrincipal *aOther, bool *aResult)
 {
   *aResult = false;
@@ -747,20 +737,20 @@ nsExpandedPrincipal::GetDomain(nsIURI** 
 
 NS_IMETHODIMP
 nsExpandedPrincipal::SetDomain(nsIURI* aDomain)
 {
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsExpandedPrincipal::GetOrigin(char** aOrigin)
+nsExpandedPrincipal::GetOrigin(nsACString& aOrigin)
 {
-  *aOrigin = ToNewCString(NS_LITERAL_CSTRING(EXPANDED_PRINCIPAL_SPEC));
-  return *aOrigin ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
+  aOrigin.AssignLiteral(EXPANDED_PRINCIPAL_SPEC);
+  return NS_OK;
 }
 
 typedef nsresult (NS_STDCALL nsIPrincipal::*nsIPrincipalMemFn)(nsIPrincipal* aOther,
                                                                bool* aResult);
 #define CALL_MEMBER_FUNCTION(THIS,MEM_FN)  ((THIS)->*(MEM_FN))
 
 // nsExpandedPrincipal::Equals and nsExpandedPrincipal::EqualsConsideringDomain
 // shares the same logic. The difference only that Equals requires 'this'
--- a/caps/nsPrincipal.h
+++ b/caps/nsPrincipal.h
@@ -23,17 +23,17 @@ public:
   NS_DECL_NSISERIALIZABLE
   NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr) override;
   NS_IMETHOD Equals(nsIPrincipal* other, bool* _retval) override;
   NS_IMETHOD EqualsConsideringDomain(nsIPrincipal* other, bool* _retval) override;
   NS_IMETHOD GetHashValue(uint32_t* aHashValue) override;
   NS_IMETHOD GetURI(nsIURI** aURI) override;
   NS_IMETHOD GetDomain(nsIURI** aDomain) override;
   NS_IMETHOD SetDomain(nsIURI* aDomain) override;
-  NS_IMETHOD GetOrigin(char** aOrigin) override;
+  NS_IMETHOD GetOrigin(nsACString& aOrigin) override;
   NS_IMETHOD Subsumes(nsIPrincipal* other, bool* _retval) override;
   NS_IMETHOD SubsumesConsideringDomain(nsIPrincipal* other, bool* _retval) override;
   NS_IMETHOD CheckMayLoad(nsIURI* uri, bool report, bool allowIfInheritsPrincipal) override;
   NS_IMETHOD GetJarPrefix(nsACString& aJarPrefix) override;
   NS_IMETHOD GetAppStatus(uint16_t* aAppStatus) override;
   NS_IMETHOD GetAppId(uint32_t* aAppStatus) override;
   NS_IMETHOD GetIsInBrowserElement(bool* aIsInBrowserElement) override;
   NS_IMETHOD GetUnknownAppId(bool* aUnknownAppId) override;
@@ -65,17 +65,17 @@ public:
 
     return false;
   }
 
 
   /**
    * Computes the puny-encoded origin of aURI.
    */
-  static nsresult GetOriginForURI(nsIURI* aURI, char **aOrigin);
+  static nsresult GetOriginForURI(nsIURI* aURI, nsACString& aOrigin);
 
   /**
    * Called at startup to setup static data, e.g. about:config pref-observers.
    */
   static void InitializeStatics();
 
   nsCOMPtr<nsIURI> mDomain;
   nsCOMPtr<nsIURI> mCodebase;
@@ -111,17 +111,17 @@ public:
   NS_IMETHODIMP_(MozExternalRefCountType) Release() override { return nsJSPrincipals::Release(); };
   NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr) override;
   NS_IMETHOD Equals(nsIPrincipal* other, bool* _retval) override;
   NS_IMETHOD EqualsConsideringDomain(nsIPrincipal* other, bool* _retval) override;
   NS_IMETHOD GetHashValue(uint32_t* aHashValue) override;
   NS_IMETHOD GetURI(nsIURI** aURI) override;
   NS_IMETHOD GetDomain(nsIURI** aDomain) override;
   NS_IMETHOD SetDomain(nsIURI* aDomain) override;
-  NS_IMETHOD GetOrigin(char** aOrigin) override;
+  NS_IMETHOD GetOrigin(nsACString& aOrigin) override;
   NS_IMETHOD Subsumes(nsIPrincipal* other, bool* _retval) override;
   NS_IMETHOD SubsumesConsideringDomain(nsIPrincipal* other, bool* _retval) override;
   NS_IMETHOD CheckMayLoad(nsIURI* uri, bool report, bool allowIfInheritsPrincipal) override;
   NS_IMETHOD GetJarPrefix(nsACString& aJarPrefix) override;
   NS_IMETHOD GetAppStatus(uint16_t* aAppStatus) override;
   NS_IMETHOD GetAppId(uint32_t* aAppStatus) override;
   NS_IMETHOD GetIsInBrowserElement(bool* aIsInBrowserElement) override;
   NS_IMETHOD GetUnknownAppId(bool* aUnknownAppId) override;
--- a/caps/nsScriptSecurityManager.cpp
+++ b/caps/nsScriptSecurityManager.cpp
@@ -276,30 +276,30 @@ nsScriptSecurityManager::AppStatusForPri
     appsService->GetAppByLocalId(appId, getter_AddRefs(app));
     NS_ENSURE_TRUE(app, nsIPrincipal::APP_STATUS_NOT_INSTALLED);
 
     uint16_t status = nsIPrincipal::APP_STATUS_INSTALLED;
     NS_ENSURE_SUCCESS(app->GetAppStatus(&status),
                       nsIPrincipal::APP_STATUS_NOT_INSTALLED);
 
     nsAutoCString origin;
-    NS_ENSURE_SUCCESS(aPrin->GetOrigin(getter_Copies(origin)),
+    NS_ENSURE_SUCCESS(aPrin->GetOrigin(origin),
                       nsIPrincipal::APP_STATUS_NOT_INSTALLED);
     nsString appOrigin;
     NS_ENSURE_SUCCESS(app->GetOrigin(appOrigin),
                       nsIPrincipal::APP_STATUS_NOT_INSTALLED);
 
     // We go from string -> nsIURI -> origin to be sure we
     // compare two punny-encoded origins.
     nsCOMPtr<nsIURI> appURI;
     NS_ENSURE_SUCCESS(NS_NewURI(getter_AddRefs(appURI), appOrigin),
                       nsIPrincipal::APP_STATUS_NOT_INSTALLED);
 
     nsAutoCString appOriginPunned;
-    NS_ENSURE_SUCCESS(nsPrincipal::GetOriginForURI(appURI, getter_Copies(appOriginPunned)),
+    NS_ENSURE_SUCCESS(nsPrincipal::GetOriginForURI(appURI, appOriginPunned),
                       nsIPrincipal::APP_STATUS_NOT_INSTALLED);
 
     if (!appOriginPunned.Equals(origin)) {
         return nsIPrincipal::APP_STATUS_NOT_INSTALLED;
     }
 
     return status;
 
@@ -719,20 +719,20 @@ nsScriptSecurityManager::CheckLoadURIWit
         if (hasFlags) {
             // Let apps load the whitelisted theme resources even if they don't
             // have the webapps-manage permission but have the themeable one.
             // Resources from the theme origin are also allowed to load from
             // the theme origin (eg. stylesheets using images from the theme).
             auto themeOrigin = Preferences::GetCString("b2g.theme.origin");
             if (themeOrigin) {
                 nsAutoCString targetOrigin;
-                nsPrincipal::GetOriginForURI(targetBaseURI, getter_Copies(targetOrigin));
+                nsPrincipal::GetOriginForURI(targetBaseURI, targetOrigin);
                 if (targetOrigin.Equals(themeOrigin)) {
                     nsAutoCString pOrigin;
-                    aPrincipal->GetOrigin(getter_Copies(pOrigin));
+                    aPrincipal->GetOrigin(pOrigin);
                     return nsContentUtils::IsExactSitePermAllow(aPrincipal, "themeable") ||
                            pOrigin.Equals(themeOrigin)
                         ? NS_OK : NS_ERROR_DOM_BAD_URI;
                 }
             }
             // In this case, we allow opening only if the source and target URIS
             // are on the same domain, or the opening URI has the webapps
             // permision granted
--- a/caps/nsSystemPrincipal.cpp
+++ b/caps/nsSystemPrincipal.cpp
@@ -84,20 +84,20 @@ nsSystemPrincipal::GetHashValue(uint32_t
 NS_IMETHODIMP 
 nsSystemPrincipal::GetURI(nsIURI** aURI)
 {
     *aURI = nullptr;
     return NS_OK;
 }
 
 NS_IMETHODIMP 
-nsSystemPrincipal::GetOrigin(char** aOrigin)
+nsSystemPrincipal::GetOrigin(nsACString& aOrigin)
 {
-    *aOrigin = ToNewCString(NS_LITERAL_CSTRING(SYSTEM_PRINCIPAL_SPEC));
-    return *aOrigin ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
+    aOrigin.AssignLiteral(SYSTEM_PRINCIPAL_SPEC);
+    return NS_OK;
 }
 
 NS_IMETHODIMP
 nsSystemPrincipal::GetCsp(nsIContentSecurityPolicy** aCsp)
 {
   *aCsp = nullptr;
   return NS_OK;
 }
--- a/caps/nsSystemPrincipal.h
+++ b/caps/nsSystemPrincipal.h
@@ -26,17 +26,17 @@ public:
   NS_DECL_NSISERIALIZABLE
   NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr) override;
   NS_IMETHOD Equals(nsIPrincipal* other, bool* _retval) override;
   NS_IMETHOD EqualsConsideringDomain(nsIPrincipal* other, bool* _retval) override;
   NS_IMETHOD GetHashValue(uint32_t* aHashValue) override;
   NS_IMETHOD GetURI(nsIURI** aURI) override;
   NS_IMETHOD GetDomain(nsIURI** aDomain) override;
   NS_IMETHOD SetDomain(nsIURI* aDomain) override;
-  NS_IMETHOD GetOrigin(char** aOrigin) override;
+  NS_IMETHOD GetOrigin(nsACString& aOrigin) override;
   NS_IMETHOD Subsumes(nsIPrincipal* other, bool* _retval) override;
   NS_IMETHOD SubsumesConsideringDomain(nsIPrincipal* other, bool* _retval) override;
   NS_IMETHOD CheckMayLoad(nsIURI* uri, bool report, bool allowIfInheritsPrincipal) override;
   NS_IMETHOD GetCsp(nsIContentSecurityPolicy** aCsp);
   NS_IMETHOD SetCsp(nsIContentSecurityPolicy* aCsp);
   NS_IMETHOD GetJarPrefix(nsACString& aJarPrefix) override;
   NS_IMETHOD GetAppStatus(uint16_t* aAppStatus) override;
   NS_IMETHOD GetAppId(uint32_t* aAppStatus) override;
--- a/dom/cache/ManagerId.cpp
+++ b/dom/cache/ManagerId.cpp
@@ -28,17 +28,17 @@ ManagerId::Create(nsIPrincipal* aPrincip
   //
   // But, if we get the same QuotaManager directory for different about:
   // origins, we probably only want one Manager instance.  So, we might
   // want to start using the QM's concept of origin uniqueness here.
   //
   // TODO: consider using QuotaManager's modified origin here (bug 1112071)
 
   nsAutoCString origin;
-  nsresult rv = aPrincipal->GetOrigin(getter_Copies(origin));
+  nsresult rv = aPrincipal->GetOrigin(origin);
   if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
 
   uint32_t appId;
   rv = aPrincipal->GetAppId(&appId);
   if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
 
   bool inBrowserElement;
   rv = aPrincipal->GetIsInBrowserElement(&inBrowserElement);
--- a/dom/cache/PrincipalVerifier.cpp
+++ b/dom/cache/PrincipalVerifier.cpp
@@ -145,17 +145,17 @@ PrincipalVerifier::VerifyOnMainThread()
   }
 
 #ifdef DEBUG
   // Sanity check principal origin by using it to construct a URI and security
   // checking it.  Don't do this for the system principal, though, as its origin
   // is a synthetic [System Principal] string.
   if (!ssm->IsSystemPrincipal(principal)) {
     nsAutoCString origin;
-    rv = principal->GetOrigin(getter_Copies(origin));
+    rv = principal->GetOrigin(origin);
     if (NS_WARN_IF(NS_FAILED(rv))) {
       DispatchToInitiatingThread(rv);
       return;
     }
     nsCOMPtr<nsIURI> uri;
     rv = NS_NewURI(getter_AddRefs(uri), origin);
     if (NS_WARN_IF(NS_FAILED(rv))) {
       DispatchToInitiatingThread(rv);
--- a/dom/ipc/ContentParent.cpp
+++ b/dom/ipc/ContentParent.cpp
@@ -4278,17 +4278,17 @@ ContentParent::RecvAddGeolocationListene
 
     // let the the settings cache know the origin of the new listener
     nsAutoCString origin;
     // hint to the compiler to use the conversion operator to nsIPrincipal*
     nsCOMPtr<nsIPrincipal> principal = static_cast<nsIPrincipal*>(aPrincipal);
     if (!principal) {
       return true;
     }
-    principal->GetOrigin(getter_Copies(origin));
+    principal->GetOrigin(origin);
     nsRefPtr<nsGeolocationSettings> gs = nsGeolocationSettings::GetGeolocationSettings();
     if (gs) {
       gs->PutWatchOrigin(mGeolocationWatchID, origin);
     }
     return true;
 }
 
 bool
--- a/dom/media/MediaManager.cpp
+++ b/dom/media/MediaManager.cpp
@@ -2028,18 +2028,17 @@ MediaManager::GetUserMediaDevices(nsPIDO
   nsAdoptingCString loopbackAudioDevice =
     Preferences::GetCString("media.audio_loopback_dev");
   nsAdoptingCString loopbackVideoDevice =
     Preferences::GetCString("media.video_loopback_dev");
   bool useFakeStreams =
     Preferences::GetBool("media.navigator.streams.fake", false);
 
   nsCString origin;
-  nsPrincipal::GetOriginForURI(aWindow->GetDocumentURI(),
-                               getter_Copies(origin));
+  nsPrincipal::GetOriginForURI(aWindow->GetDocumentURI(), origin);
   bool inPrivateBrowsing;
   {
     nsCOMPtr<nsIDocument> doc = aWindow->GetDoc();
     nsCOMPtr<nsILoadContext> loadContext = doc->GetLoadContext();
     inPrivateBrowsing = loadContext && loadContext->UsePrivateBrowsing();
   }
   MediaManager::GetMessageLoop()->PostTask(FROM_HERE,
     new GetUserMediaDevicesTask(
--- a/dom/quota/QuotaManager.cpp
+++ b/dom/quota/QuotaManager.cpp
@@ -2601,17 +2601,17 @@ QuotaManager::GetInfoFromPrincipal(nsIPr
   NS_ENSURE_SUCCESS(rv, rv);
 
   if (isNullPrincipal) {
     NS_WARNING("IndexedDB not supported from this principal!");
     return NS_ERROR_FAILURE;
   }
 
   nsCString origin;
-  rv = aPrincipal->GetOrigin(getter_Copies(origin));
+  rv = aPrincipal->GetOrigin(origin);
   NS_ENSURE_SUCCESS(rv, rv);
 
   if (origin.EqualsLiteral(kChromeOrigin)) {
     NS_WARNING("Non-chrome principal can't use chrome origin!");
     return NS_ERROR_FAILURE;
   }
 
   nsCString jarPrefix;
--- a/extensions/cookie/nsPermissionManager.cpp
+++ b/extensions/cookie/nsPermissionManager.cpp
@@ -151,17 +151,17 @@ GetHostForPrincipal(nsIPrincipal* aPrinc
     int32_t spart = aHost.FindChar('?', 0);
     if (spart >= 0) {
       aHost.Cut(spart, aHost.Length() - spart);
     }
     return NS_OK;
   }
 
   // Some entries like "file://" uses the origin.
-  rv = aPrincipal->GetOrigin(getter_Copies(aHost));
+  rv = aPrincipal->GetOrigin(aHost);
   if (NS_SUCCEEDED(rv) && !aHost.IsEmpty()) {
     return NS_OK;
   }
 
   return NS_ERROR_UNEXPECTED;
 }
 
 nsCString
--- a/netwerk/ipc/NeckoParent.cpp
+++ b/netwerk/ipc/NeckoParent.cpp
@@ -598,17 +598,17 @@ NeckoParent::AllocPRemoteOpenFileParent(
       }
     }
 
     // Check if we load a resource from the shared theme url space.
     // If we try to load the theme but have no permission, refuse to load.
     bool themeWhitelist = false;
     if (Preferences::GetBool("dom.mozApps.themable") && appUri) {
       nsAutoCString origin;
-      nsPrincipal::GetOriginForURI(appUri, getter_Copies(origin));
+      nsPrincipal::GetOriginForURI(appUri, origin);
       nsAutoCString themeOrigin;
       themeOrigin = Preferences::GetCString("b2g.theme.origin");
       themeWhitelist = origin.Equals(themeOrigin);
       if (themeWhitelist) {
         bool hasThemePerm = false;
         mozApp->HasPermission("themeable", &hasThemePerm);
         if (!hasThemePerm) {
           return nullptr;
--- a/netwerk/protocol/app/AppProtocolHandler.cpp
+++ b/netwerk/protocol/app/AppProtocolHandler.cpp
@@ -382,17 +382,17 @@ AppProtocolHandler::NewChannel2(nsIURI* 
   nsRefPtr<nsJARChannel> channel = new nsJARChannel();
 
   nsAutoCString host;
   nsresult rv = aUri->GetHost(host);
   NS_ENSURE_SUCCESS(rv, rv);
 
   if (Preferences::GetBool("dom.mozApps.themable")) {
     nsAutoCString origin;
-    nsPrincipal::GetOriginForURI(aUri, getter_Copies(origin));
+    nsPrincipal::GetOriginForURI(aUri, origin);
     nsAdoptingCString themeOrigin;
     themeOrigin = Preferences::GetCString("b2g.theme.origin");
     if (themeOrigin.Equals(origin)) {
       // We are trying to load a theme resource. Check whether we have a
       // package registered as a theme provider to override the file path.
       nsAdoptingCString selectedTheme;
       selectedTheme = Preferences::GetCString("dom.mozApps.selected_theme");
       if (!selectedTheme.IsEmpty()) {