Bug 1274415 - Fix -Wshadow warnings in caps/ directory. r=dveditz
authorChris Peterson <cpeterson@mozilla.com>
Thu, 19 May 2016 01:04:46 -0700
changeset 298455 eeb73478d98476877f2035f0c330fdc89e361803
parent 298454 4cd4c9499c47caff5e3d04800893c1f1502a6cf5
child 298456 138521110469d3a80c58ae4571e7d0cf8e6de07c
push id19356
push usercbook@mozilla.com
push dateTue, 24 May 2016 13:16:37 +0000
treeherderfx-team@f074838712a0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdveditz
bugs1274415
milestone49.0a1
Bug 1274415 - Fix -Wshadow warnings in caps/ directory. r=dveditz caps/BasePrincipal.cpp:562:28 [-Wshadow] declaration shadows a local variable caps/nsScriptSecurityManager.cpp:675:18 [-Wshadow] declaration shadows a local variable caps/nsScriptSecurityManager.cpp:854:14 [-Wshadow] declaration shadows a local variable
caps/BasePrincipal.cpp
caps/moz.build
caps/nsScriptSecurityManager.cpp
--- a/caps/BasePrincipal.cpp
+++ b/caps/BasePrincipal.cpp
@@ -546,17 +546,16 @@ BasePrincipal::GetUnknownAppId(bool* aUn
 already_AddRefed<BasePrincipal>
 BasePrincipal::CreateCodebasePrincipal(nsIURI* aURI, const PrincipalOriginAttributes& aAttrs)
 {
   // If the URI is supposed to inherit the security context of whoever loads it,
   // we shouldn't make a codebase principal for it.
   bool inheritsPrincipal;
   nsresult rv = NS_URIChainHasFlags(aURI, nsIProtocolHandler::URI_INHERITS_SECURITY_CONTEXT,
                                     &inheritsPrincipal);
-  nsCOMPtr<nsIPrincipal> principal;
   if (NS_FAILED(rv) || inheritsPrincipal) {
     return nsNullPrincipal::Create(aAttrs);
   }
 
   // Check whether the URI knows what its principal is supposed to be.
   nsCOMPtr<nsIURIWithPrincipal> uriPrinc = do_QueryInterface(aURI);
   if (uriPrinc) {
     nsCOMPtr<nsIPrincipal> principal;
--- a/caps/moz.build
+++ b/caps/moz.build
@@ -55,11 +55,8 @@ LOCAL_INCLUDES += [
 ]
 
 if CONFIG['ENABLE_TESTS']:
     DIRS += ['tests/gtest']
 
 include('/ipc/chromium/chromium-config.mozbuild')
 
 FINAL_LIBRARY = 'xul'
-
-if CONFIG['GNU_CXX']:
-    CXXFLAGS += ['-Wno-error=shadow']
--- a/caps/nsScriptSecurityManager.cpp
+++ b/caps/nsScriptSecurityManager.cpp
@@ -667,17 +667,17 @@ EqualOrSubdomain(nsIURI* aProbeArg, nsIU
     nsCOMPtr<nsIEffectiveTLDService> tldService = do_GetService(NS_EFFECTIVETLDSERVICE_CONTRACTID);
     NS_ENSURE_TRUE(tldService, false);
     while (true) {
         if (nsScriptSecurityManager::SecurityCompareURIs(probe, aBase)) {
             return true;
         }
 
         nsAutoCString host, newHost;
-        nsresult rv = probe->GetHost(host);
+        rv = probe->GetHost(host);
         NS_ENSURE_SUCCESS(rv, false);
 
         rv = tldService->GetNextSubDomain(host, newHost);
         if (rv == NS_ERROR_INSUFFICIENT_DOMAIN_LEVELS) {
             return false;
         }
         NS_ENSURE_SUCCESS(rv, false);
         rv = probe->SetHost(newHost);
@@ -845,18 +845,16 @@ nsScriptSecurityManager::CheckLoadURIWit
               sourceScheme.EqualsIgnoreCase(targetScheme.get()) &&
               NS_SUCCEEDED(aTargetURI->SchemeIs("view-source", &targetIsViewSource)) &&
               targetIsViewSource))
     {
         // every scheme can access another URI from the same scheme,
         // as long as they don't represent null principals...
         // Or they don't require an special permission to do so
         // See bug#773886
-
-        bool hasFlags;
         rv = NS_URIChainHasFlags(targetBaseURI,
                                  nsIProtocolHandler::URI_CROSS_ORIGIN_NEEDS_WEBAPPS_PERM,
                                  &hasFlags);
         NS_ENSURE_SUCCESS(rv, rv);
 
         if (hasFlags) {
             // Let apps load the whitelisted theme resources even if they don't
             // have the webapps-manage permission but have the themeable one.