Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(295)

Side by Side Diff: third_party/WebKit/Source/core/frame/csp/CSPSource.cpp

Issue 2508033004: Reduce unnecessary usage of TextCaseSensitivity::TextCaseInsensitive. (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/frame/csp/CSPSource.h" 5 #include "core/frame/csp/CSPSource.h"
6 6
7 #include "core/frame/UseCounter.h" 7 #include "core/frame/UseCounter.h"
8 #include "core/frame/csp/ContentSecurityPolicy.h" 8 #include "core/frame/csp/ContentSecurityPolicy.h"
9 #include "platform/weborigin/KURL.h" 9 #include "platform/weborigin/KURL.h"
10 #include "platform/weborigin/KnownPorts.h" 10 #include "platform/weborigin/KnownPorts.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 return protocol == "ws" || protocol == "wss"; 50 return protocol == "ws" || protocol == "wss";
51 return protocol == m_scheme; 51 return protocol == m_scheme;
52 } 52 }
53 53
54 bool CSPSource::hostMatches(const String& host) const { 54 bool CSPSource::hostMatches(const String& host) const {
55 Document* document = m_policy->document(); 55 Document* document = m_policy->document();
56 bool match; 56 bool match;
57 57
58 bool equalHosts = m_host == host; 58 bool equalHosts = m_host == host;
59 if (m_hostWildcard == HasWildcard) { 59 if (m_hostWildcard == HasWildcard) {
60 match = host.endsWith(String("." + m_host), TextCaseInsensitive); 60 match = host.endsWith(String("." + m_host), TextCaseUnicodeInsensitive);
61 61
62 // Chrome used to, incorrectly, match *.x.y to x.y. This was fixed, but 62 // Chrome used to, incorrectly, match *.x.y to x.y. This was fixed, but
63 // the following count measures when a match fails that would have 63 // the following count measures when a match fails that would have
64 // passed the old, incorrect style, in case a lot of sites were 64 // passed the old, incorrect style, in case a lot of sites were
65 // relying on that behavior. 65 // relying on that behavior.
66 if (document && equalHosts) 66 if (document && equalHosts)
67 UseCounter::count(*document, 67 UseCounter::count(*document,
68 UseCounter::CSPSourceWildcardWouldMatchExactHost); 68 UseCounter::CSPSourceWildcardWouldMatchExactHost);
69 } else { 69 } else {
70 match = equalHosts; 70 match = equalHosts;
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 return false; 181 return false;
182 } 182 }
183 return true; 183 return true;
184 } 184 }
185 185
186 DEFINE_TRACE(CSPSource) { 186 DEFINE_TRACE(CSPSource) {
187 visitor->trace(m_policy); 187 visitor->trace(m_policy);
188 } 188 }
189 189
190 } // namespace blink 190 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/fetch/Resource.cpp ('k') | third_party/WebKit/Source/core/html/HTMLElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698