Bug 1368107 - Make some TransportSecurityInfo nsresult functions return void. r?keeler draft
authorCykesiopka <cykesiopka.bmo@gmail.com>
Sat, 27 May 2017 01:10:28 +0800
changeset 585202 c890f24fe4572a45fab19499b1975516f6ae0f04
parent 585201 730e2144ecf5a2b0dddd2798d49e860c1b53ffd5
child 585203 5c9b7fbfde99cbad377f127be1f891248ab1d0a9
push id61050
push usercykesiopka.bmo@gmail.com
push dateFri, 26 May 2017 17:11:08 +0000
reviewerskeeler
bugs1368107
milestone55.0a1
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;
   }