Changeset 96239 in webkit


Ignore:
Timestamp:
Sep 28, 2011 11:06:54 AM (13 years ago)
Author:
abarth@webkit.org
Message:

CSP doesn't work for a wide variety of cases
https://bugs.webkit.org/show_bug.cgi?id=68921

Reviewed by Darin Adler.

Patch suggested by Sam Weinig. It's unclear to me how to test this
change because all our tests run on non-default ports, which is why we
have this bug in the first place. Mozilla uses a proxy while testing
so they can test with URLs like http://example.com, but we don't have
such a facility.

  • page/ContentSecurityPolicy.cpp:

(WebCore::CSPSource::portMatches):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r96233 r96239  
     12011-09-28  Adam Barth  <abarth@webkit.org>
     2
     3        CSP doesn't work for a wide variety of cases
     4        https://bugs.webkit.org/show_bug.cgi?id=68921
     5
     6        Reviewed by Darin Adler.
     7
     8        Patch suggested by Sam Weinig.  It's unclear to me how to test this
     9        change because all our tests run on non-default ports, which is why we
     10        have this bug in the first place.  Mozilla uses a proxy while testing
     11        so they can test with URLs like http://example.com, but we don't have
     12        such a facility.
     13
     14        * page/ContentSecurityPolicy.cpp:
     15        (WebCore::CSPSource::portMatches):
     16
    1172011-09-28  Fady Samuel  <fsamuel@chromium.org>
    218
  • trunk/Source/WebCore/page/ContentSecurityPolicy.cpp

    r95901 r96239  
    148148        if (m_portHasWildcard)
    149149            return true;
     150
    150151        int port = url.port();
    151         return port ? port == m_port : isDefaultPortForProtocol(m_port, url.protocol());
     152
     153        if (port == m_port)
     154            return true;
     155
     156        if (!port)
     157            return isDefaultPortForProtocol(m_port, m_scheme);
     158
     159        if (!m_port)
     160            return isDefaultPortForProtocol(port, m_scheme);
     161
     162        return false;
    152163    }
    153164
Note: See TracChangeset for help on using the changeset viewer.