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

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

Issue 2125873003: CSP: Allow ':80' to match ':443' in source expressions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 months 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/frame/csp/CSPSourceTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 bool CSPSource::portMatches(const KURL& url) const 84 bool CSPSource::portMatches(const KURL& url) const
85 { 85 {
86 if (m_portWildcard == HasWildcard) 86 if (m_portWildcard == HasWildcard)
87 return true; 87 return true;
88 88
89 int port = url.port(); 89 int port = url.port();
90 90
91 if (port == m_port) 91 if (port == m_port)
92 return true; 92 return true;
93 93
94 if (m_port == 80 && (port == 443 || (port == 0 && defaultPortForProtocol(url .protocol()) == 443)))
95 return true;
96
94 if (!port) 97 if (!port)
95 return isDefaultPortForProtocol(m_port, url.protocol()); 98 return isDefaultPortForProtocol(m_port, url.protocol());
96 99
97 if (!m_port) 100 if (!m_port)
98 return isDefaultPortForProtocol(port, url.protocol()); 101 return isDefaultPortForProtocol(port, url.protocol());
99 102
100 return false; 103 return false;
101 } 104 }
102 105
103 bool CSPSource::isSchemeOnly() const 106 bool CSPSource::isSchemeOnly() const
104 { 107 {
105 return m_host.isEmpty(); 108 return m_host.isEmpty();
106 } 109 }
107 110
108 DEFINE_TRACE(CSPSource) 111 DEFINE_TRACE(CSPSource)
109 { 112 {
110 visitor->trace(m_policy); 113 visitor->trace(m_policy);
111 } 114 }
112 115
113 } // namespace blink 116 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/frame/csp/CSPSourceTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698