Changeset 28343 in webkit


Ignore:
Timestamp:
Dec 3, 2007 2:36:03 AM (16 years ago)
Author:
zecke@webkit.org
Message:

2007-12-02 Holger Hans Peter Freyther <holger.freyther@trolltech.com>

Reviewed by Sam Weinig.

  • Add FrameLoader::shouldTreatSchemeAsLocal which is similar to shouldTreatURLAsLocal.
  • Make use of FrameLoader::shouldTreatSchemeAsLocal in SecurityOrigin and do not hardcode "file". This is needed for the WebKit/qt port to make the Web Inspector work as it using the qrc protocol instead of file.
  • loader/FrameLoader.cpp: (WebCore::FrameLoader::shouldTreatSchemeAsLocal):
  • loader/FrameLoader.h:
  • platform/SecurityOrigin.cpp: (WebCore::SecurityOrigin::isSecureTransitionTo):
Location:
trunk/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r28342 r28343  
     12007-12-02  Holger Hans Peter Freyther  <holger.freyther@trolltech.com>
     2
     3        Reviewed by Sam Weinig.
     4
     5        * Add FrameLoader::shouldTreatSchemeAsLocal which is similar to
     6        shouldTreatURLAsLocal.
     7        * Make use of FrameLoader::shouldTreatSchemeAsLocal in SecurityOrigin
     8        and do not hardcode "file". This is needed for the WebKit/qt port to make
     9        the Web Inspector work as it using the qrc protocol instead of file.
     10
     11
     12        * loader/FrameLoader.cpp:
     13        (WebCore::FrameLoader::shouldTreatSchemeAsLocal):
     14        * loader/FrameLoader.h:
     15        * platform/SecurityOrigin.cpp:
     16        (WebCore::SecurityOrigin::isSecureTransitionTo):
     17
    1182007-12-02  Holger Hans Peter Freyther  <holger.freyther@trolltech.com>
    219
  • trunk/WebCore/loader/FrameLoader.cpp

    r28342 r28343  
    46344634}
    46354635
     4636bool FrameLoader::shouldTreatSchemeAsLocal(const String& scheme)
     4637{
     4638    // This avoids an allocation of another String and the HashSet contains()
     4639    // call for the file: and http: schemes.
     4640    if (scheme.length() == 4) {
     4641        const UChar* s = scheme.characters();
     4642        if (s[0] == 'h' && s[1] == 't' && s[2] == 't' && s[3] == 'p')
     4643            return false;
     4644        if (s[0] == 'f' && s[1] == 'i' && s[2] == 'l' && s[3] == 'e')
     4645            return true;
     4646    }
     4647
     4648    if (scheme.isEmpty())
     4649        return false;
     4650
     4651    return localSchemes().contains(scheme);
     4652}
     4653
    46364654void FrameLoader::dispatchDidCommitLoad()
    46374655{
  • trunk/WebCore/loader/FrameLoader.h

    r28056 r28343  
    422422        static bool restrictAccessToLocal();
    423423        static void setRestrictAccessToLocal(bool);
    424         static bool shouldTreatURLAsLocal(const String& url);
     424        static bool shouldTreatURLAsLocal(const String&);
     425        static bool shouldTreatSchemeAsLocal(const String&);
    425426
    426427#if USE(LOW_BANDWIDTH_DISPLAY)   
  • trunk/WebCore/platform/SecurityOrigin.cpp

    r27821 r28343  
    111111bool SecurityOrigin::canAccess(const SecurityOrigin& other) const
    112112{
    113     if (m_protocol == "file")
     113    if (FrameLoader::shouldTreatSchemeAsLocal(m_protocol))
    114114        return true;
    115115
     
    129129        return true;
    130130
    131     if (m_protocol == "file")
     131    if (FrameLoader::shouldTreatSchemeAsLocal(m_protocol))
    132132        return true;
    133133
Note: See TracChangeset for help on using the changeset viewer.