Changeset 57923 in webkit


Ignore:
Timestamp:
Apr 20, 2010 2:50:32 PM (14 years ago)
Author:
timothy@apple.com
Message:

Fix matching of "file:///*" patterns by not trying to compare the host. The host is
irrelevant for file URLs.

Also fix comparisons to be case insensitive.

https://bugs.webkit.org/show_bug.cgi?id=37889

Reviewed by Dave Hyatt.

  • page/UserContentURLPattern.cpp:

(WebCore::UserContentURLPattern::parse): Use equalIgnoringCase when comparing for "file" schemes.
(WebCore::UserContentURLPattern::matches): Use equalIgnoringCase when comparing schemes. Only call
matchesHost if the scheme isn't "file".
(WebCore::UserContentURLPattern::matchesHost): Call equalIgnoringCase when comparing hosts. The endsWith
was already doing a case-insensitive compare, so existing tests worked though this path.

Location:
trunk/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r57922 r57923  
     12010-04-20  Timothy Hatcher  <timothy@apple.com>
     2
     3        Fix matching of "file:///*" patterns by not trying to compare the host. The host is
     4        irrelevant for file URLs.
     5
     6        Also fix comparisons to be case insensitive.
     7
     8        https://bugs.webkit.org/show_bug.cgi?id=37889
     9
     10        Reviewed by Dave Hyatt.
     11
     12        * page/UserContentURLPattern.cpp:
     13        (WebCore::UserContentURLPattern::parse): Use equalIgnoringCase when comparing for "file" schemes.
     14        (WebCore::UserContentURLPattern::matches): Use equalIgnoringCase when comparing schemes. Only call
     15        matchesHost if the scheme isn't "file".
     16        (WebCore::UserContentURLPattern::matchesHost): Call equalIgnoringCase when comparing hosts. The endsWith
     17        was already doing a case-insensitive compare, so existing tests worked though this path.
     18
    1192010-04-20  Justin Schuh  <jschuh@chromium.org>
    220
  • trunk/WebCore/page/UserContentURLPattern.cpp

    r49033 r57923  
    7676    int pathStartPos = 0;
    7777
    78     if (m_scheme == "file")
     78    if (equalIgnoringCase(m_scheme, "file"))
    7979        pathStartPos = hostStartPos;
    8080    else {
     
    115115        return false;
    116116
    117     if (test.protocol() != m_scheme)
    118         return false;
    119 
    120     if (!matchesHost(test))
     117    if (!equalIgnoringCase(test.protocol(), m_scheme))
     118        return false;
     119
     120    if (!equalIgnoringCase(m_scheme, "file") && !matchesHost(test))
    121121        return false;
    122122
     
    126126bool UserContentURLPattern::matchesHost(const KURL& test) const
    127127{
    128     if (test.host() == m_host)
     128    if (equalIgnoringCase(test.host(), m_host))
    129129        return true;
    130130
Note: See TracChangeset for help on using the changeset viewer.