Remove variable shadowing in blink/modules/credentialmanager
In an effort to reduce or even ban variable shadowing, this renames
a variable to avoid such shadowing. I'm interested in prohibiting
shadowing because I think it might prevent potential jumbo problems.
The exact error this avoids is:
third_party/blink/renderer/modules/credentialmanager/credentials_container.cc:180:23: error: declaration shadows a local variable [-Werror,-Wshadow]
OriginAccessEntry access_entry(
^
third_party/blink/renderer/modules/credentialmanager/credentials_container.cc:166:21: note: previous declaration is here
OriginAccessEntry access_entry(
^
Bug: 923510
Change-Id: I61b11ecd489ed9842e1a9ebee9293050f7f1cde5
Reviewed-on: https://chromium-review.googlesource.com/c/1478890
Reviewed-by: Kentaro Hara <haraken@chromium.org>
Commit-Queue: Daniel Bratell <bratell@opera.com>
Cr-Commit-Position: refs/heads/master@{#633742}
diff --git a/third_party/blink/renderer/modules/credentialmanager/credentials_container.cc b/third_party/blink/renderer/modules/credentialmanager/credentials_container.cc
index fee856ff..5b85a3f 100644
--- a/third_party/blink/renderer/modules/credentialmanager/credentials_container.cc
+++ b/third_party/blink/renderer/modules/credentialmanager/credentials_container.cc
@@ -163,10 +163,14 @@
// TODO(crbug.com/803077): Avoid constructing an OriginAccessEntry just
// for the IP address check.
- OriginAccessEntry access_entry(
- origin->Protocol(), effective_domain,
- network::mojom::CorsOriginAccessMatchMode::kAllowSubdomains);
- if (effective_domain.IsEmpty() || access_entry.HostIsIPAddress()) {
+ bool reject_because_invalid_domain = effective_domain.IsEmpty();
+ if (!reject_because_invalid_domain) {
+ OriginAccessEntry access_entry(
+ origin->Protocol(), effective_domain,
+ network::mojom::CorsOriginAccessMatchMode::kAllowSubdomains);
+ reject_because_invalid_domain = access_entry.HostIsIPAddress();
+ }
+ if (reject_because_invalid_domain) {
resolver->Reject(
DOMException::Create(DOMExceptionCode::kSecurityError,
"Effective domain is not a valid domain."));