Bug 1368107 - Make some TransportSecurityInfo nsresult functions return void. r=keeler
authorCykesiopka <cykesiopka.bmo@gmail.com>
Sat, 03 Jun 2017 13:36:16 +0800
changeset 412703 69bac2d5d3bd520ccf2380ba2080753efe24d61d
parent 412702 8d8bd769125e1eb326ed71c72b19406cfa74bc5c
child 412704 5b49816e53239ecdb2bb344461b84785bdd47d95
push id1490
push usermtabara@mozilla.com
push dateMon, 31 Jul 2017 14:08:16 +0000
treeherdermozilla-release@70e32e6bf15e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskeeler
bugs1368107
milestone55.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 1368107 - Make some TransportSecurityInfo nsresult functions return void. r=keeler These functions in practice are all infallible and are unchecked by callers, so there's no point in having them return nsresult. MozReview-Commit-ID: BOypKLUZZBi
security/manager/ssl/TransportSecurityInfo.cpp
security/manager/ssl/TransportSecurityInfo.h
--- a/security/manager/ssl/TransportSecurityInfo.cpp
+++ b/security/manager/ssl/TransportSecurityInfo.cpp
@@ -71,29 +71,27 @@ NS_IMPL_ISUPPORTS(TransportSecurityInfo,
                   nsIClassInfo)
 
 void
 TransportSecurityInfo::SetHostName(const char* host)
 {
   mHostName.Assign(host);
 }
 
-nsresult
+void
 TransportSecurityInfo::SetPort(int32_t aPort)
 {
   mPort = aPort;
-  return NS_OK;
 }
 
-nsresult
+void
 TransportSecurityInfo::SetOriginAttributes(
   const OriginAttributes& aOriginAttributes)
 {
   mOriginAttributes = aOriginAttributes;
-  return NS_OK;
 }
 
 PRErrorCode
 TransportSecurityInfo::GetErrorCode() const
 {
   MutexAutoLock lock(mMutex);
 
   return mErrorCode;
@@ -112,21 +110,20 @@ TransportSecurityInfo::SetCanceled(PRErr
 
 NS_IMETHODIMP
 TransportSecurityInfo::GetSecurityState(uint32_t* state)
 {
   *state = mSecurityState;
   return NS_OK;
 }
 
-nsresult
+void
 TransportSecurityInfo::SetSecurityState(uint32_t aState)
 {
   mSecurityState = aState;
-  return NS_OK;
 }
 
 NS_IMETHODIMP
 TransportSecurityInfo::GetCountSubRequestsBrokenSecurity(
   int32_t *aSubRequestsBrokenSecurity)
 {
   *aSubRequestsBrokenSecurity = mSubRequestsBrokenSecurity;
   return NS_OK;
@@ -485,22 +482,20 @@ TransportSecurityInfo::GetSSLStatus(nsIS
   NS_ENSURE_ARG_POINTER(_result);
 
   *_result = mSSLStatus;
   NS_IF_ADDREF(*_result);
 
   return NS_OK;
 }
 
-nsresult
+void
 TransportSecurityInfo::SetSSLStatus(nsSSLStatus *aSSLStatus)
 {
   mSSLStatus = aSSLStatus;
-
-  return NS_OK;
 }
 
 /* Formats an error message for non-certificate-related SSL errors
  * and non-overridable certificate errors (both are of type
  * PlainErrormMessage). Use formatOverridableCertErrorMessage
  * for overridable cert errors.
  */
 static nsresult
--- a/security/manager/ssl/TransportSecurityInfo.h
+++ b/security/manager/ssl/TransportSecurityInfo.h
@@ -47,41 +47,41 @@ public:
   NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSITRANSPORTSECURITYINFO
   NS_DECL_NSIINTERFACEREQUESTOR
   NS_DECL_NSISSLSTATUSPROVIDER
   NS_DECL_NSIASSOCIATEDCONTENTSECURITY
   NS_DECL_NSISERIALIZABLE
   NS_DECL_NSICLASSINFO
 
-  nsresult SetSecurityState(uint32_t aState);
+  void SetSecurityState(uint32_t aState);
 
   const nsACString & GetHostName() const { return mHostName; }
 
   void SetHostName(const char* host);
 
   int32_t GetPort() const { return mPort; }
-  nsresult SetPort(int32_t aPort);
+  void SetPort(int32_t aPort);
 
   const OriginAttributes& GetOriginAttributes() const {
     return mOriginAttributes;
   }
-  nsresult SetOriginAttributes(const OriginAttributes& aOriginAttributes);
+  void SetOriginAttributes(const OriginAttributes& aOriginAttributes);
 
   PRErrorCode GetErrorCode() const;
 
   void GetErrorLogMessage(PRErrorCode errorCode,
                           ::mozilla::psm::SSLErrorMessageType errorMessageType,
                           nsString &result);
 
   void SetCanceled(PRErrorCode errorCode,
                    ::mozilla::psm::SSLErrorMessageType errorMessageType);
 
   /* Set SSL Status values */
-  nsresult SetSSLStatus(nsSSLStatus *aSSLStatus);
+  void SetSSLStatus(nsSSLStatus* aSSLStatus);
   nsSSLStatus* SSLStatus() { return mSSLStatus; }
   void SetStatusErrorBits(nsNSSCertificate* cert, uint32_t collected_errors);
 
   nsresult SetFailedCertChain(UniqueCERTCertList certList);
 
 private:
   mutable ::mozilla::Mutex mMutex;
 
@@ -131,20 +131,19 @@ private:
 
 public:
   void RememberCertHasError(TransportSecurityInfo * infoobject,
                             nsSSLStatus * status,
                             SECStatus certVerificationResult);
   void LookupCertErrorBits(TransportSecurityInfo * infoObject,
                            nsSSLStatus* status);
 
-  static nsresult Init()
+  static void Init()
   {
     sInstance = new RememberCertErrorsTable();
-    return NS_OK;
   }
 
   static RememberCertErrorsTable & GetInstance()
   {
     MOZ_ASSERT(sInstance);
     return *sInstance;
   }