Changeset 49211 in webkit


Ignore:
Timestamp:
Oct 6, 2009 6:05:05 PM (15 years ago)
Author:
eric@webkit.org
Message:

2009-10-06 Adam Barth <abarth@webkit.org>

Reviewed by Eric Seidel.

Move setLocalLoadPolicy and friends to SecurityOrigin
https://bugs.webkit.org/show_bug.cgi?id=30110

These have more to do with security policies than with loading frames.

  • WebCore.base.exp:
  • dom/Document.cpp: (WebCore::Document::initSecurityContext):
  • loader/Cache.cpp: (WebCore::Cache::requestResource):
  • loader/FrameLoader.cpp:
  • loader/FrameLoader.h:
  • loader/SubresourceLoader.cpp: (WebCore::SubresourceLoader::create):
  • page/SecurityOrigin.cpp: (WebCore::SecurityOrigin::setLocalLoadPolicy): (WebCore::SecurityOrigin::restrictAccessToLocal): (WebCore::SecurityOrigin::allowSubstituteDataAccessToLocal):
  • page/SecurityOrigin.h: (WebCore::SecurityOrigin::):

2009-10-06 Adam Barth <abarth@webkit.org>

Reviewed by Eric Seidel.

Move setLocalLoadPolicy and friends to SecurityOrigin
https://bugs.webkit.org/show_bug.cgi?id=30110

Call the new API.

  • WebView/WebView.mm: (-[WebView _commonInitializationWithFrameName:groupName:usesDocumentViews:]):

2009-10-06 Adam Barth <abarth@webkit.org>

Reviewed by Eric Seidel.

Move setLocalLoadPolicy and friends to SecurityOrigin
https://bugs.webkit.org/show_bug.cgi?id=30110

Call the new API.

  • Api/qwebpage.cpp: (QWebPagePrivate::QWebPagePrivate):
Location:
trunk
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r49210 r49211  
     12009-10-06  Adam Barth  <abarth@webkit.org>
     2
     3        Reviewed by Eric Seidel.
     4
     5        Move setLocalLoadPolicy and friends to SecurityOrigin
     6        https://bugs.webkit.org/show_bug.cgi?id=30110
     7
     8        These have more to do with security policies than with loading frames.
     9
     10        * WebCore.base.exp:
     11        * dom/Document.cpp:
     12        (WebCore::Document::initSecurityContext):
     13        * loader/Cache.cpp:
     14        (WebCore::Cache::requestResource):
     15        * loader/FrameLoader.cpp:
     16        * loader/FrameLoader.h:
     17        * loader/SubresourceLoader.cpp:
     18        (WebCore::SubresourceLoader::create):
     19        * page/SecurityOrigin.cpp:
     20        (WebCore::SecurityOrigin::setLocalLoadPolicy):
     21        (WebCore::SecurityOrigin::restrictAccessToLocal):
     22        (WebCore::SecurityOrigin::allowSubstituteDataAccessToLocal):
     23        * page/SecurityOrigin.h:
     24        (WebCore::SecurityOrigin::):
     25
    1262009-10-06  Brian Weinstein  <bweinstein@apple.com>
    227
  • trunk/WebCore/WebCore.base.exp

    r49136 r49211  
    165165__ZN7WebCore11FrameLoader17stopForUserCancelEb
    166166__ZN7WebCore11FrameLoader18currentHistoryItemEv
    167 __ZN7WebCore11FrameLoader18setLocalLoadPolicyENS0_15LocalLoadPolicyE
    168167__ZN7WebCore11FrameLoader18shouldHideReferrerERKNS_4KURLERKNS_6StringE
    169168__ZN7WebCore11FrameLoader21loadURLIntoChildFrameERKNS_4KURLERKNS_6StringEPNS_5FrameE
     
    303302__ZN7WebCore14ResourceLoader19setShouldBufferDataEb
    304303__ZN7WebCore14SecurityOrigin16createFromStringERKNS_6StringE
     304__ZN7WebCore14SecurityOrigin18setLocalLoadPolicyENS0_15LocalLoadPolicyE
    305305__ZN7WebCore14SecurityOrigin24registerURLSchemeAsLocalERKNS_6StringE
    306306__ZN7WebCore14SecurityOrigin25whiteListAccessFromOriginERKS0_RKNS_6StringES5_b
  • trunk/WebCore/dom/Document.cpp

    r49043 r49211  
    42404240    ScriptExecutionContext::setSecurityOrigin(SecurityOrigin::create(url));
    42414241
    4242     if (FrameLoader::allowSubstituteDataAccessToLocal()) {
     4242    if (SecurityOrigin::allowSubstituteDataAccessToLocal()) {
    42434243        // If this document was loaded with substituteData, then the document can
    42444244        // load local resources.  See https://bugs.webkit.org/show_bug.cgi?id=16756
  • trunk/WebCore/loader/Cache.cpp

    r47907 r49211  
    3535#include "Image.h"
    3636#include "ResourceHandle.h"
     37#include "SecurityOrigin.h"
    3738#include <stdio.h>
    3839#include <wtf/CurrentTime.h>
     
    105106        return 0;
    106107   
    107     if (FrameLoader::restrictAccessToLocal() && !FrameLoader::canLoad(url, String(), docLoader->doc())) {
     108    if (SecurityOrigin::restrictAccessToLocal() && !FrameLoader::canLoad(url, String(), docLoader->doc())) {
    108109        Document* doc = docLoader->doc();
    109110        if (doc && !requestIsPreload)
  • trunk/WebCore/loader/FrameLoader.cpp

    r49196 r49211  
    130130#endif
    131131static double storedTimeOfLastCompletedLoad;
    132 static FrameLoader::LocalLoadPolicy localLoadPolicy = FrameLoader::AllowLocalLoadsForLocalOnly;
    133132
    134133bool isBackForwardLoadType(FrameLoadType type)
     
    10571056       
    10581057    m_iconLoader->startLoading();
    1059 }
    1060 
    1061 void FrameLoader::setLocalLoadPolicy(LocalLoadPolicy policy)
    1062 {
    1063     localLoadPolicy = policy;
    1064 }
    1065 
    1066 bool FrameLoader::restrictAccessToLocal()
    1067 {
    1068     return localLoadPolicy != FrameLoader::AllowLocalLoadsForAll;
    1069 }
    1070 
    1071 bool FrameLoader::allowSubstituteDataAccessToLocal()
    1072 {
    1073     return localLoadPolicy != FrameLoader::AllowLocalLoadsForLocalOnly;
    10741058}
    10751059
  • trunk/WebCore/loader/FrameLoader.h

    r49196 r49211  
    315315        void setCurrentHistoryItem(PassRefPtr<HistoryItem>);
    316316
    317         enum LocalLoadPolicy {
    318             AllowLocalLoadsForAll,  // No restriction on local loads.
    319             AllowLocalLoadsForLocalAndSubstituteData,
    320             AllowLocalLoadsForLocalOnly,
    321         };
    322         static void setLocalLoadPolicy(LocalLoadPolicy);
    323         static bool restrictAccessToLocal();
    324         static bool allowSubstituteDataAccessToLocal();
    325 
    326317        bool committingFirstRealLoad() const { return !m_creatingInitialEmptyDocument && !m_committedFirstRealDocumentLoad; }
    327318        bool committedFirstRealDocumentLoad() const { return m_committedFirstRealDocumentLoad; }
  • trunk/WebCore/loader/SubresourceLoader.cpp

    r43650 r49211  
    3434#include "FrameLoader.h"
    3535#include "ResourceHandle.h"
     36#include "SecurityOrigin.h"
    3637#include "SubresourceLoaderClient.h"
    3738#include <wtf/RefCountedLeakCounter.h>
     
    7374
    7475    if (!skipCanLoadCheck
    75             && FrameLoader::restrictAccessToLocal()
     76            && SecurityOrigin::restrictAccessToLocal()
    7677            && !FrameLoader::canLoad(request.url(), String(), frame->document())) {
    7778        FrameLoader::reportLocalLoadFailed(frame, request.url().string());
  • trunk/WebCore/page/SecurityOrigin.cpp

    r49160 r49211  
    3131
    3232#include "CString.h"
    33 #include "FrameLoader.h"
    3433#include "KURL.h"
    3534#include "OriginAccessEntry.h"
     
    3736
    3837namespace WebCore {
     38
     39static SecurityOrigin::LocalLoadPolicy localLoadPolicy = SecurityOrigin::AllowLocalLoadsForLocalOnly;
    3940
    4041typedef Vector<OriginAccessEntry> OriginAccessWhiteList;
     
    245246    // the privilege can obtain the privilege by injecting script into the
    246247    // documents that have been granted the privilege.
    247     ASSERT(FrameLoader::allowSubstituteDataAccessToLocal());
     248    ASSERT(allowSubstituteDataAccessToLocal());
    248249    m_canLoadLocalResources = true;
    249250}
     
    371372}
    372373
    373 // static
    374374void SecurityOrigin::registerURLSchemeAsLocal(const String& scheme)
    375375{
     
    377377}
    378378
    379 // static
    380379void SecurityOrigin::removeURLSchemeRegisteredAsLocal(const String& scheme)
    381380{
     
    393392}
    394393
    395 // static
    396394const URLSchemesMap&  SecurityOrigin::localURLSchemes()
    397395{
     
    399397}
    400398
    401 // static
    402399bool SecurityOrigin::shouldTreatURLAsLocal(const String& url)
    403400{
     
    420417}
    421418
    422 // static
    423419bool SecurityOrigin::shouldTreatURLSchemeAsLocal(const String& scheme)
    424420{
     
    439435}
    440436
    441 // static
    442437void SecurityOrigin::registerURLSchemeAsNoAccess(const String& scheme)
    443438{
     
    445440}
    446441
    447 // static
    448442bool SecurityOrigin::shouldTreatURLSchemeAsNoAccess(const String& scheme)
    449443{
    450444    return noAccessSchemes().contains(scheme);
     445}
     446
     447void SecurityOrigin::setLocalLoadPolicy(LocalLoadPolicy policy)
     448{
     449    localLoadPolicy = policy;
     450}
     451
     452bool SecurityOrigin::restrictAccessToLocal()
     453{
     454    return localLoadPolicy != SecurityOrigin::AllowLocalLoadsForAll;
     455}
     456
     457bool SecurityOrigin::allowSubstituteDataAccessToLocal()
     458{
     459    return localLoadPolicy != SecurityOrigin::AllowLocalLoadsForLocalOnly;
    451460}
    452461
  • trunk/WebCore/page/SecurityOrigin.h

    r49160 r49211  
    144144        static bool shouldTreatURLSchemeAsLocal(const String&);
    145145
     146        enum LocalLoadPolicy {
     147            AllowLocalLoadsForAll,  // No restriction on local loads.
     148            AllowLocalLoadsForLocalAndSubstituteData,
     149            AllowLocalLoadsForLocalOnly,
     150        };
     151        static void setLocalLoadPolicy(LocalLoadPolicy);
     152        static bool restrictAccessToLocal();
     153        static bool allowSubstituteDataAccessToLocal();
     154
    146155        static void registerURLSchemeAsNoAccess(const String&);
    147156        static bool shouldTreatURLSchemeAsNoAccess(const String&);
  • trunk/WebKit/mac/ChangeLog

    r49206 r49211  
     12009-10-06  Adam Barth  <abarth@webkit.org>
     2
     3        Reviewed by Eric Seidel.
     4
     5        Move setLocalLoadPolicy and friends to SecurityOrigin
     6        https://bugs.webkit.org/show_bug.cgi?id=30110
     7
     8        Call the new API.
     9
     10        * WebView/WebView.mm:
     11        (-[WebView _commonInitializationWithFrameName:groupName:usesDocumentViews:]):
     12
    1132009-10-06  Simon Fraser  <simon.fraser@apple.com>
    214
  • trunk/WebKit/mac/WebView/WebView.mm

    r49149 r49211  
    664664    if (!WebKitLinkedOnOrAfter(WEBKIT_FIRST_VERSION_WITH_LOCAL_RESOURCE_SECURITY_RESTRICTION)) {
    665665        // Originally, we allowed all local loads.
    666         FrameLoader::setLocalLoadPolicy(FrameLoader::AllowLocalLoadsForAll);
     666        SecurityOrigin::setLocalLoadPolicy(SecurityOrigin::AllowLocalLoadsForAll);
    667667    } else if (!WebKitLinkedOnOrAfter(WEBKIT_FIRST_VERSION_WITH_MORE_STRICT_LOCAL_RESOURCE_SECURITY_RESTRICTION)) {
    668668        // Later, we allowed local loads for local URLs and documents loaded
    669669        // with substitute data.
    670         FrameLoader::setLocalLoadPolicy(FrameLoader::AllowLocalLoadsForLocalAndSubstituteData);
     670        SecurityOrigin::setLocalLoadPolicy(SecurityOrigin::AllowLocalLoadsForLocalAndSubstituteData);
    671671    }
    672672
  • trunk/WebKit/qt/Api/qwebpage.cpp

    r49102 r49211  
    272272    WebCore::InitializeLoggingChannelsIfNecessary();
    273273    JSC::initializeThreading();
    274     WebCore::FrameLoader::setLocalLoadPolicy(WebCore::FrameLoader::AllowLocalLoadsForLocalAndSubstituteData);
     274    WebCore::SecurityOrigin::setLocalLoadPolicy(WebCore::SecurityOrigin::AllowLocalLoadsForLocalAndSubstituteData);
    275275
    276276    chromeClient = new ChromeClientQt(q);
  • trunk/WebKit/qt/ChangeLog

    r49200 r49211  
     12009-10-06  Adam Barth  <abarth@webkit.org>
     2
     3        Reviewed by Eric Seidel.
     4
     5        Move setLocalLoadPolicy and friends to SecurityOrigin
     6        https://bugs.webkit.org/show_bug.cgi?id=30110
     7
     8        Call the new API.
     9
     10        * Api/qwebpage.cpp:
     11        (QWebPagePrivate::QWebPagePrivate):
     12
    1132009-10-06  Benjamin C Meyer  <bmeyer@rim.com>
    214
Note: See TracChangeset for help on using the changeset viewer.