| Index: Source/core/frame/csp/CSPSourceList.cpp
|
| diff --git a/Source/core/frame/csp/CSPSourceList.cpp b/Source/core/frame/csp/CSPSourceList.cpp
|
| index d16fbab12a42688ec6e82f9b19f79fbdeef88ef2..da259835b8b1e68e184baf290e714b7a7406ade8 100644
|
| --- a/Source/core/frame/csp/CSPSourceList.cpp
|
| +++ b/Source/core/frame/csp/CSPSourceList.cpp
|
| @@ -111,10 +111,10 @@
|
|
|
| String scheme, host, path;
|
| int port = 0;
|
| - bool hostHasWildcard = false;
|
| - bool portHasWildcard = false;
|
| -
|
| - if (parseSource(beginSource, position, scheme, host, port, path, hostHasWildcard, portHasWildcard)) {
|
| + CSPSource::WildcardDisposition hostWildcard = CSPSource::NoWildcard;
|
| + CSPSource::WildcardDisposition portWildcard = CSPSource::NoWildcard;
|
| +
|
| + if (parseSource(beginSource, position, scheme, host, port, path, hostWildcard, portWildcard)) {
|
| // Wildcard hosts and keyword sources ('self', 'unsafe-inline',
|
| // etc.) aren't stored in m_list, but as attributes on the source
|
| // list itself.
|
| @@ -122,7 +122,7 @@
|
| continue;
|
| if (m_policy->isDirectiveName(host))
|
| m_policy->reportDirectiveAsSourceExpression(m_directiveName, host);
|
| - m_list.append(CSPSource(m_policy, scheme, host, port, path, hostHasWildcard, portHasWildcard));
|
| + m_list.append(CSPSource(m_policy, scheme, host, port, path, hostWildcard, portWildcard));
|
| } else {
|
| m_policy->reportInvalidSourceExpression(m_directiveName, String(beginSource, position - beginSource));
|
| }
|
| @@ -134,7 +134,7 @@
|
| // source = scheme ":"
|
| // / ( [ scheme "://" ] host [ port ] [ path ] )
|
| // / "'self'"
|
| -bool CSPSourceList::parseSource(const UChar* begin, const UChar* end, String& scheme, String& host, int& port, String& path, bool& hostHasWildcard, bool& portHasWildcard)
|
| +bool CSPSourceList::parseSource(const UChar* begin, const UChar* end, String& scheme, String& host, int& port, String& path, CSPSource::WildcardDisposition& hostWildcard, CSPSource::WildcardDisposition& portWildcard)
|
| {
|
| if (begin == end)
|
| return false;
|
| @@ -191,13 +191,13 @@
|
| if (position == end) {
|
| // host
|
| // ^
|
| - return parseHost(beginHost, position, host, hostHasWildcard);
|
| + return parseHost(beginHost, position, host, hostWildcard);
|
| }
|
|
|
| if (position < end && *position == '/') {
|
| // host/path || host/ || /
|
| // ^ ^ ^
|
| - return parseHost(beginHost, position, host, hostHasWildcard) && parsePath(position, end, path);
|
| + return parseHost(beginHost, position, host, hostWildcard) && parsePath(position, end, path);
|
| }
|
|
|
| if (position < end && *position == ':') {
|
| @@ -237,11 +237,11 @@
|
| beginPath = position;
|
| }
|
|
|
| - if (!parseHost(beginHost, beginPort ? beginPort : beginPath, host, hostHasWildcard))
|
| + if (!parseHost(beginHost, beginPort ? beginPort : beginPath, host, hostWildcard))
|
| return false;
|
|
|
| if (beginPort) {
|
| - if (!parsePort(beginPort, beginPath, port, portHasWildcard))
|
| + if (!parsePort(beginPort, beginPath, port, portWildcard))
|
| return false;
|
| } else {
|
| port = 0;
|
| @@ -366,11 +366,11 @@
|
| // / "*"
|
| // host-char = ALPHA / DIGIT / "-"
|
| //
|
| -bool CSPSourceList::parseHost(const UChar* begin, const UChar* end, String& host, bool& hostHasWildcard)
|
| +bool CSPSourceList::parseHost(const UChar* begin, const UChar* end, String& host, CSPSource::WildcardDisposition& hostWildcard)
|
| {
|
| ASSERT(begin <= end);
|
| ASSERT(host.isEmpty());
|
| - ASSERT(!hostHasWildcard);
|
| + ASSERT(hostWildcard == CSPSource::NoWildcard);
|
|
|
| if (begin == end)
|
| return false;
|
| @@ -378,7 +378,7 @@
|
| const UChar* position = begin;
|
|
|
| if (skipExactly<UChar>(position, end, '*')) {
|
| - hostHasWildcard = true;
|
| + hostWildcard = CSPSource::HasWildcard;
|
|
|
| if (position == end)
|
| return true;
|
| @@ -425,11 +425,11 @@
|
|
|
| // port = ":" ( 1*DIGIT / "*" )
|
| //
|
| -bool CSPSourceList::parsePort(const UChar* begin, const UChar* end, int& port, bool& portHasWildcard)
|
| +bool CSPSourceList::parsePort(const UChar* begin, const UChar* end, int& port, CSPSource::WildcardDisposition& portWildcard)
|
| {
|
| ASSERT(begin <= end);
|
| ASSERT(!port);
|
| - ASSERT(!portHasWildcard);
|
| + ASSERT(portWildcard == CSPSource::NoWildcard);
|
|
|
| if (!skipExactly<UChar>(begin, end, ':'))
|
| ASSERT_NOT_REACHED();
|
| @@ -439,7 +439,7 @@
|
|
|
| if (end - begin == 1 && *begin == '*') {
|
| port = 0;
|
| - portHasWildcard = true;
|
| + portWildcard = CSPSource::HasWildcard;
|
| return true;
|
| }
|
|
|
|
|