Bug 1310127 - Part 14: Use MOZ_MUST_USE in netwerk/protocol/http r?tnikkel draft
authorWei-Cheng Pan <wpan@mozilla.com>
Tue, 20 Dec 2016 11:51:33 +0800
changeset 494461 f6392231f844f2a926cc1efff3907ded6a759152
parent 494460 aa6d85722ce98f05544cca9816798e26a38f8c46
child 494462 b36367a2f00f6825e6d98868a145846b301f6ad9
push id48029
push userbmo:wpan@mozilla.com
push dateTue, 07 Mar 2017 03:35:29 +0000
reviewerstnikkel
bugs1310127
milestone54.0a1
Bug 1310127 - Part 14: Use MOZ_MUST_USE in netwerk/protocol/http r?tnikkel MozReview-Commit-ID: Gvv80wYQ7JI
image/imgLoader.cpp
image/imgRequest.cpp
--- a/image/imgLoader.cpp
+++ b/image/imgLoader.cpp
@@ -826,25 +826,28 @@ NewImageChannel(nsIChannel** aResult,
       aLoadingPrincipal,
       aURI,
       /* aInheritForAboutBlank */ false,
       /* aForceInherit */ false);
 
   // Initialize HTTP-specific attributes
   newHttpChannel = do_QueryInterface(*aResult);
   if (newHttpChannel) {
-    newHttpChannel->SetRequestHeader(NS_LITERAL_CSTRING("Accept"),
-                                     aAcceptHeader,
-                                     false);
+    rv = newHttpChannel->SetRequestHeader(NS_LITERAL_CSTRING("Accept"),
+                                          aAcceptHeader,
+                                          false);
+    MOZ_ASSERT(NS_SUCCEEDED(rv));
 
     nsCOMPtr<nsIHttpChannelInternal> httpChannelInternal =
       do_QueryInterface(newHttpChannel);
     NS_ENSURE_TRUE(httpChannelInternal, NS_ERROR_UNEXPECTED);
-    httpChannelInternal->SetDocumentURI(aInitialDocumentURI);
-    newHttpChannel->SetReferrerWithPolicy(aReferringURI, aReferrerPolicy);
+    rv = httpChannelInternal->SetDocumentURI(aInitialDocumentURI);
+    MOZ_ASSERT(NS_SUCCEEDED(rv));
+    rv = newHttpChannel->SetReferrerWithPolicy(aReferringURI, aReferrerPolicy);
+    MOZ_ASSERT(NS_SUCCEEDED(rv));
   }
 
   // Image channels are loaded by default with reduced priority.
   nsCOMPtr<nsISupportsPriority> p = do_QueryInterface(*aResult);
   if (p) {
     uint32_t priority = nsISupportsPriority::PRIORITY_LOW;
 
     if (aLoadFlags & nsIRequest::LOAD_BACKGROUND) {
--- a/image/imgRequest.cpp
+++ b/image/imgRequest.cpp
@@ -594,27 +594,27 @@ imgRequest::SetCacheValidation(imgCacheE
     }
 
     // Determine whether the cache entry must be revalidated when we try to use
     // it. Currently, only HTTP specifies this information...
     nsCOMPtr<nsIHttpChannel> httpChannel(do_QueryInterface(aRequest));
     if (httpChannel) {
       bool bMustRevalidate = false;
 
-      httpChannel->IsNoStoreResponse(&bMustRevalidate);
+      Unused << httpChannel->IsNoStoreResponse(&bMustRevalidate);
 
       if (!bMustRevalidate) {
-        httpChannel->IsNoCacheResponse(&bMustRevalidate);
+        Unused << httpChannel->IsNoCacheResponse(&bMustRevalidate);
       }
 
       if (!bMustRevalidate) {
         nsAutoCString cacheHeader;
 
-        httpChannel->GetResponseHeader(NS_LITERAL_CSTRING("Cache-Control"),
-                                            cacheHeader);
+        Unused << httpChannel->GetResponseHeader(NS_LITERAL_CSTRING("Cache-Control"),
+                                                 cacheHeader);
         if (PL_strcasestr(cacheHeader.get(), "must-revalidate")) {
           bMustRevalidate = true;
         }
       }
 
       // Cache entries default to not needing to validate. We ensure that
       // multiple calls to this function don't override an earlier decision to
       // validate by making validation a one-way decision.