Bug 1149280 part 2. Drop the useless mScheme member of nsNullPrincipalURI. r=smaug
authorBoris Zbarsky <bzbarsky@mit.edu>
Tue, 31 Mar 2015 13:11:04 -0400
changeset 266730 c39ec40cb4e181df6b8be94c75da1d68a0945ade
parent 266729 60d47f6038172abe1291384867198b18fd6a517e
child 266731 4156586d7ac617e1deab5fdaab5790e00d42844d
push id4830
push userjlund@mozilla.com
push dateMon, 29 Jun 2015 20:18:48 +0000
treeherdermozilla-beta@4c2175bb0420 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1149280
milestone40.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 1149280 part 2. Drop the useless mScheme member of nsNullPrincipalURI. r=smaug
caps/nsNullPrincipalURI.cpp
caps/nsNullPrincipalURI.h
--- a/caps/nsNullPrincipalURI.cpp
+++ b/caps/nsNullPrincipalURI.cpp
@@ -15,24 +15,22 @@
 #include "nsEscape.h"
 #include "nsCRT.h"
 #include "nsIUUIDGenerator.h"
 
 ////////////////////////////////////////////////////////////////////////////////
 //// nsNullPrincipalURI
 
 nsNullPrincipalURI::nsNullPrincipalURI()
-  : mScheme(NS_NULLPRINCIPAL_SCHEME),
-    mPath(mPathBytes, ArrayLength(mPathBytes), ArrayLength(mPathBytes) - 1)
+  : mPath(mPathBytes, ArrayLength(mPathBytes), ArrayLength(mPathBytes) - 1)
 {
 }
 
 nsNullPrincipalURI::nsNullPrincipalURI(const nsNullPrincipalURI& aOther)
-  : mScheme(NS_NULLPRINCIPAL_SCHEME),
-    mPath(mPathBytes, ArrayLength(mPathBytes), ArrayLength(mPathBytes) - 1)
+  : mPath(mPathBytes, ArrayLength(mPathBytes), ArrayLength(mPathBytes) - 1)
 {
   mPath.Assign(aOther.mPath);
 }
 
 nsresult
 nsNullPrincipalURI::Init()
 {
   // FIXME: bug 327161 -- make sure the uuid generator is reseeding-resistant.
@@ -166,17 +164,17 @@ NS_IMETHODIMP
 nsNullPrincipalURI::SetRef(const nsACString &aRef)
 {
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 NS_IMETHODIMP
 nsNullPrincipalURI::GetPrePath(nsACString &_prePath)
 {
-  _prePath = mScheme + NS_LITERAL_CSTRING(":");
+  _prePath = NS_LITERAL_CSTRING(NS_NULLPRINCIPAL_SCHEME ":");
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsNullPrincipalURI::GetPort(int32_t *_port)
 {
   return NS_ERROR_NOT_IMPLEMENTED;
 }
@@ -185,30 +183,30 @@ NS_IMETHODIMP
 nsNullPrincipalURI::SetPort(int32_t aPort)
 {
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 NS_IMETHODIMP
 nsNullPrincipalURI::GetScheme(nsACString &_scheme)
 {
-  _scheme = mScheme;
+  _scheme = NS_LITERAL_CSTRING(NS_NULLPRINCIPAL_SCHEME);
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsNullPrincipalURI::SetScheme(const nsACString &aScheme)
 {
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 NS_IMETHODIMP
 nsNullPrincipalURI::GetSpec(nsACString &_spec)
 {
-  _spec = mScheme + NS_LITERAL_CSTRING(":") + mPath;
+  _spec = NS_LITERAL_CSTRING(NS_NULLPRINCIPAL_SCHEME ":") + mPath;
   return NS_OK;
 }
 
 // result may contain unescaped UTF-8 characters
 NS_IMETHODIMP
 nsNullPrincipalURI::GetSpecIgnoringRef(nsACString &result)
 {
   return GetSpec(result);
@@ -270,17 +268,17 @@ nsNullPrincipalURI::CloneIgnoringRef(nsI
 NS_IMETHODIMP
 nsNullPrincipalURI::Equals(nsIURI *aOther, bool *_equals)
 {
   *_equals = false;
   nsNullPrincipalURI *otherURI;
   nsresult rv = aOther->QueryInterface(kNullPrincipalURIImplementationCID,
                                        (void **)&otherURI);
   if (NS_SUCCEEDED(rv)) {
-    *_equals = (mScheme == otherURI->mScheme && mPath == otherURI->mPath);
+    *_equals = mPath == otherURI->mPath;
     NS_RELEASE(otherURI);
   }
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsNullPrincipalURI::EqualsExceptRef(nsIURI *aOther, bool *_equals)
 {
@@ -295,17 +293,17 @@ nsNullPrincipalURI::Resolve(const nsACSt
 {
   _resolvedURI = aRelativePath;
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsNullPrincipalURI::SchemeIs(const char *aScheme, bool *_schemeIs)
 {
-  *_schemeIs = (0 == nsCRT::strcasecmp(mScheme.get(), aScheme));
+  *_schemeIs = (0 == nsCRT::strcasecmp(NS_NULLPRINCIPAL_SCHEME, aScheme));
   return NS_OK;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 //// nsIIPCSerializableURI
 
 void
 nsNullPrincipalURI::Serialize(mozilla::ipc::URIParams &aParams)
@@ -328,17 +326,16 @@ nsNullPrincipalURI::Deserialize(const mo
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 //// nsISizeOf
 
 size_t
 nsNullPrincipalURI::SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const
 {
-  return mScheme.SizeOfExcludingThisIfUnshared(aMallocSizeOf) +
-         mPath.SizeOfExcludingThisIfUnshared(aMallocSizeOf);
+  return mPath.SizeOfExcludingThisIfUnshared(aMallocSizeOf);
 }
 
 size_t
 nsNullPrincipalURI::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const {
   return aMallocSizeOf(this) + SizeOfExcludingThis(aMallocSizeOf);
 }
 
--- a/caps/nsNullPrincipalURI.h
+++ b/caps/nsNullPrincipalURI.h
@@ -49,13 +49,12 @@ public:
 private:
   nsNullPrincipalURI(const nsNullPrincipalURI& aOther);
 
   ~nsNullPrincipalURI() {}
 
   nsresult Init();
 
   char mPathBytes[NSID_LENGTH];
-  nsCString mScheme;
   nsFixedCString mPath;
 };
 
 #endif // __nsNullPrincipalURI_h__