[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

japhet at chromium.org japhet at chromium.org
Thu Apr 8 00:37:49 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit a330a3e3e974359e28f1fd4738a0cc316a126b2a
Author: japhet at chromium.org <japhet at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Dec 15 23:02:11 2009 +0000

    2009-12-15  Nate Chapin  <japhet at chromium.org>
    
            Reviewed by Darin Adler.
    
            Rename skipCanLoadCheck to skipSecurityCheck in a bunch of places in WebCore/loader.
    
            https://bugs.webkit.org/show_bug.cgi?id=32529
    
            * loader/Cache.cpp:
            (WebCore::Cache::requestUserCSSStyleSheet):
            * loader/CachedImage.cpp:
            (WebCore::CachedImage::load):
            * loader/CachedResource.cpp:
            (WebCore::CachedResource::load):
            * loader/CachedResource.h:
            (WebCore::CachedResource::load):
            * loader/DocumentThreadableLoader.cpp:
            (WebCore::DocumentThreadableLoader::DocumentThreadableLoader):
            (WebCore::DocumentThreadableLoader::makeSimpleCrossOriginAccessRequest):
            (WebCore::DocumentThreadableLoader::makeCrossOriginAccessRequestWithPreflight):
            (WebCore::DocumentThreadableLoader::preflightSuccess):
            (WebCore::DocumentThreadableLoader::loadRequest):
            * loader/DocumentThreadableLoader.h:
            * loader/FrameLoaderTypes.h:
            (WebCore::):
            * loader/Request.cpp:
            (WebCore::Request::Request):
            * loader/Request.h:
            (WebCore::Request::shouldDoSecurityCheck):
            * loader/SubresourceLoader.cpp:
            (WebCore::SubresourceLoader::create):
            * loader/SubresourceLoader.h:
            * loader/loader.cpp:
            (WebCore::Loader::load):
            (WebCore::Loader::Host::servePendingRequests):
            * loader/loader.h:
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@52177 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 0a7491d..4788cc6 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,40 @@
+2009-12-15  Nate Chapin  <japhet at chromium.org>
+
+        Reviewed by Darin Adler.
+
+        Rename skipCanLoadCheck to skipSecurityCheck in a bunch of places in WebCore/loader.
+
+        https://bugs.webkit.org/show_bug.cgi?id=32529
+
+        * loader/Cache.cpp:
+        (WebCore::Cache::requestUserCSSStyleSheet):
+        * loader/CachedImage.cpp:
+        (WebCore::CachedImage::load):
+        * loader/CachedResource.cpp:
+        (WebCore::CachedResource::load):
+        * loader/CachedResource.h:
+        (WebCore::CachedResource::load):
+        * loader/DocumentThreadableLoader.cpp:
+        (WebCore::DocumentThreadableLoader::DocumentThreadableLoader):
+        (WebCore::DocumentThreadableLoader::makeSimpleCrossOriginAccessRequest):
+        (WebCore::DocumentThreadableLoader::makeCrossOriginAccessRequestWithPreflight):
+        (WebCore::DocumentThreadableLoader::preflightSuccess):
+        (WebCore::DocumentThreadableLoader::loadRequest):
+        * loader/DocumentThreadableLoader.h:
+        * loader/FrameLoaderTypes.h:
+        (WebCore::):
+        * loader/Request.cpp:
+        (WebCore::Request::Request):
+        * loader/Request.h:
+        (WebCore::Request::shouldDoSecurityCheck):
+        * loader/SubresourceLoader.cpp:
+        (WebCore::SubresourceLoader::create):
+        * loader/SubresourceLoader.h:
+        * loader/loader.cpp:
+        (WebCore::Loader::load):
+        (WebCore::Loader::Host::servePendingRequests):
+        * loader/loader.h:
+
 2009-12-15  Dan Bernstein  <mitz at apple.com>
 
         Reviewed by Darin Adler.
diff --git a/WebCore/loader/Cache.cpp b/WebCore/loader/Cache.cpp
index 46fb068..a19fb98 100644
--- a/WebCore/loader/Cache.cpp
+++ b/WebCore/loader/Cache.cpp
@@ -31,6 +31,7 @@
 #include "DocLoader.h"
 #include "Document.h"
 #include "FrameLoader.h"
+#include "FrameLoaderTypes.h"
 #include "FrameView.h"
 #include "Image.h"
 #include "ResourceHandle.h"
@@ -164,7 +165,7 @@ CachedCSSStyleSheet* Cache::requestUserCSSStyleSheet(DocLoader* docLoader, const
         // FIXME: CachedResource should just use normal refcounting instead.
         userSheet->setInCache(true);
         // Don't load incrementally, skip load checks, don't send resource load callbacks.
-        userSheet->load(docLoader, false, true, false);
+        userSheet->load(docLoader, false, SkipSecurityCheck, false);
         if (!disabled())
             m_resources.set(url, userSheet);
         else
diff --git a/WebCore/loader/CachedImage.cpp b/WebCore/loader/CachedImage.cpp
index e610ad1..026b129 100644
--- a/WebCore/loader/CachedImage.cpp
+++ b/WebCore/loader/CachedImage.cpp
@@ -30,6 +30,7 @@
 #include "CachedResourceClientWalker.h"
 #include "DocLoader.h"
 #include "Frame.h"
+#include "FrameLoaderTypes.h"
 #include "FrameView.h"
 #include "Request.h"
 #include "Settings.h"
@@ -81,7 +82,7 @@ void CachedImage::decodedDataDeletionTimerFired(Timer<CachedImage>*)
 void CachedImage::load(DocLoader* docLoader)
 {
     if (!docLoader || docLoader->autoLoadImages())
-        CachedResource::load(docLoader, true, false, true);
+        CachedResource::load(docLoader, true, DoSecurityCheck, true);
     else
         m_loading = false;
 }
diff --git a/WebCore/loader/CachedResource.cpp b/WebCore/loader/CachedResource.cpp
index f2f52b0..4011a3b 100644
--- a/WebCore/loader/CachedResource.cpp
+++ b/WebCore/loader/CachedResource.cpp
@@ -103,10 +103,10 @@ CachedResource::~CachedResource()
         m_docLoader->removeCachedResource(this);
 }
     
-void CachedResource::load(DocLoader* docLoader, bool incremental, bool skipCanLoadCheck, bool sendResourceLoadCallbacks)
+void CachedResource::load(DocLoader* docLoader, bool incremental, SecurityCheckPolicy securityCheck, bool sendResourceLoadCallbacks)
 {
     m_sendResourceLoadCallbacks = sendResourceLoadCallbacks;
-    cache()->loader()->load(docLoader, this, incremental, skipCanLoadCheck, sendResourceLoadCallbacks);
+    cache()->loader()->load(docLoader, this, incremental, securityCheck, sendResourceLoadCallbacks);
     m_loading = true;
 }
 
diff --git a/WebCore/loader/CachedResource.h b/WebCore/loader/CachedResource.h
index 66ca1b1..619c09b 100644
--- a/WebCore/loader/CachedResource.h
+++ b/WebCore/loader/CachedResource.h
@@ -24,6 +24,7 @@
 #define CachedResource_h
 
 #include "CachePolicy.h"
+#include "FrameLoaderTypes.h"
 #include "PlatformString.h"
 #include "ResourceResponse.h"
 #include "SharedBuffer.h"
@@ -75,8 +76,8 @@ public:
     CachedResource(const String& url, Type);
     virtual ~CachedResource();
     
-    virtual void load(DocLoader* docLoader)  { load(docLoader, false, false, true); }
-    void load(DocLoader*, bool incremental, bool skipCanLoadCheck, bool sendResourceLoadCallbacks);
+    virtual void load(DocLoader* docLoader)  { load(docLoader, false, DoSecurityCheck, true); }
+    void load(DocLoader*, bool incremental, SecurityCheckPolicy, bool sendResourceLoadCallbacks);
 
     virtual void setEncoding(const String&) { }
     virtual String encoding() const { return String(); }
diff --git a/WebCore/loader/DocumentThreadableLoader.cpp b/WebCore/loader/DocumentThreadableLoader.cpp
index 8a223fd..de0a0b0 100644
--- a/WebCore/loader/DocumentThreadableLoader.cpp
+++ b/WebCore/loader/DocumentThreadableLoader.cpp
@@ -70,8 +70,7 @@ DocumentThreadableLoader::DocumentThreadableLoader(Document* document, Threadabl
     ASSERT(client);
 
     if (m_sameOriginRequest || m_options.crossOriginRequestPolicy == AllowCrossOriginRequests) {
-        bool skipCanLoadCheck = false;
-        loadRequest(request, skipCanLoadCheck);
+        loadRequest(request, DoSecurityCheck);
         return;
     }
 
@@ -111,8 +110,7 @@ void DocumentThreadableLoader::makeSimpleCrossOriginAccessRequest(const Resource
     crossOriginRequest.setAllowCookies(m_options.allowCredentials);
     crossOriginRequest.setHTTPOrigin(m_document->securityOrigin()->toString());
 
-    bool skipCanLoadCheck = false;
-    loadRequest(crossOriginRequest, skipCanLoadCheck);
+    loadRequest(crossOriginRequest, DoSecurityCheck);
 }
 
 void DocumentThreadableLoader::makeCrossOriginAccessRequestWithPreflight(const ResourceRequest& request)
@@ -142,8 +140,7 @@ void DocumentThreadableLoader::makeCrossOriginAccessRequestWithPreflight(const R
         preflightRequest.setHTTPHeaderField("Access-Control-Request-Headers", String::adopt(headerBuffer));
     }
 
-    bool skipCanLoadCheck = false;
-    loadRequest(preflightRequest, skipCanLoadCheck);
+    loadRequest(preflightRequest, DoSecurityCheck);
 }
 
 DocumentThreadableLoader::~DocumentThreadableLoader()
@@ -284,8 +281,8 @@ void DocumentThreadableLoader::preflightSuccess()
     OwnPtr<ResourceRequest> actualRequest;
     actualRequest.swap(m_actualRequest);
 
-    bool skipCanLoadCheck = true;  // ok to skip load check since we already asked about the preflight request
-    loadRequest(*actualRequest, skipCanLoadCheck);
+    // It should be ok to skip the security check since we already asked about the preflight request.
+    loadRequest(*actualRequest, SkipSecurityCheck);
 }
 
 void DocumentThreadableLoader::preflightFailure()
@@ -293,7 +290,7 @@ void DocumentThreadableLoader::preflightFailure()
     m_client->didFail(ResourceError());
 }
 
-void DocumentThreadableLoader::loadRequest(const ResourceRequest& request, bool skipCanLoadCheck)
+void DocumentThreadableLoader::loadRequest(const ResourceRequest& request, SecurityCheckPolicy securityCheck)
 {
     if (m_async) {
         // Don't sniff content or send load callbacks for the preflight request.
@@ -302,7 +299,7 @@ void DocumentThreadableLoader::loadRequest(const ResourceRequest& request, bool
 
         // Clear the loader so that any callbacks from SubresourceLoader::create will not have the old loader.
         m_loader = 0;
-        m_loader = SubresourceLoader::create(m_document->frame(), this, request, skipCanLoadCheck, sendLoadCallbacks, sniffContent);
+        m_loader = SubresourceLoader::create(m_document->frame(), this, request, securityCheck, sendLoadCallbacks, sniffContent);
         return;
     }
     
diff --git a/WebCore/loader/DocumentThreadableLoader.h b/WebCore/loader/DocumentThreadableLoader.h
index 7eb7f1c..48d1551 100644
--- a/WebCore/loader/DocumentThreadableLoader.h
+++ b/WebCore/loader/DocumentThreadableLoader.h
@@ -31,6 +31,7 @@
 #ifndef DocumentThreadableLoader_h
 #define DocumentThreadableLoader_h
 
+#include "FrameLoaderTypes.h"
 #include "SubresourceLoaderClient.h"
 #include "ThreadableLoader.h"
 #include <wtf/OwnPtr.h>
@@ -85,7 +86,7 @@ namespace WebCore {
         void preflightSuccess();
         void preflightFailure();
 
-        void loadRequest(const ResourceRequest&, bool skipCanLoadCheck);
+        void loadRequest(const ResourceRequest&, SecurityCheckPolicy);
         bool isAllowedRedirect(const KURL&);
 
         RefPtr<SubresourceLoader> m_loader;
diff --git a/WebCore/loader/FrameLoaderTypes.h b/WebCore/loader/FrameLoaderTypes.h
index af3dde4..8288bce 100644
--- a/WebCore/loader/FrameLoaderTypes.h
+++ b/WebCore/loader/FrameLoaderTypes.h
@@ -102,6 +102,11 @@ namespace WebCore {
         SandboxScripts = 1 << 4,
         SandboxAll = -1 // Mask with all bits set to 1.
     };
+    
+    enum SecurityCheckPolicy {
+        SkipSecurityCheck,
+        DoSecurityCheck
+    };
 
     typedef int SandboxFlags;
 }
diff --git a/WebCore/loader/Request.cpp b/WebCore/loader/Request.cpp
index 7791a48..630a4bb 100644
--- a/WebCore/loader/Request.cpp
+++ b/WebCore/loader/Request.cpp
@@ -28,12 +28,12 @@
 
 namespace WebCore {
 
-Request::Request(DocLoader* docLoader, CachedResource* object, bool incremental, bool shouldSkipCanLoadCheck, bool sendResourceLoadCallbacks)
+Request::Request(DocLoader* docLoader, CachedResource* object, bool incremental, SecurityCheckPolicy shouldDoSecurityCheck, bool sendResourceLoadCallbacks)
     : m_object(object)
     , m_docLoader(docLoader)
     , m_incremental(incremental)
     , m_multipart(false)
-    , m_shouldSkipCanLoadCheck(shouldSkipCanLoadCheck)
+    , m_shouldDoSecurityCheck(shouldDoSecurityCheck)
     , m_sendResourceLoadCallbacks(sendResourceLoadCallbacks)
 {
     m_object->setRequest(this);
diff --git a/WebCore/loader/Request.h b/WebCore/loader/Request.h
index 1e02d77..468f8ff 100644
--- a/WebCore/loader/Request.h
+++ b/WebCore/loader/Request.h
@@ -23,6 +23,7 @@
 #ifndef Request_h
 #define Request_h
 
+#include "FrameLoaderTypes.h"
 #include <wtf/Vector.h>
 
 namespace WebCore {
@@ -32,7 +33,7 @@ namespace WebCore {
 
     class Request : public Noncopyable {
     public:
-        Request(DocLoader*, CachedResource*, bool incremental, bool skipCanLoadCheck, bool sendResourceLoadCallbacks);
+        Request(DocLoader*, CachedResource*, bool incremental, SecurityCheckPolicy, bool sendResourceLoadCallbacks);
         ~Request();
         
         Vector<char>& buffer() { return m_buffer; }
@@ -45,7 +46,7 @@ namespace WebCore {
         bool isMultipart() { return m_multipart; }
         void setIsMultipart(bool b = true) { m_multipart = b; }
 
-        bool shouldSkipCanLoadCheck() const { return m_shouldSkipCanLoadCheck; }
+        SecurityCheckPolicy shouldDoSecurityCheck() const { return m_shouldDoSecurityCheck; }
         bool sendResourceLoadCallbacks() const { return m_sendResourceLoadCallbacks; }
         
     private:
@@ -54,7 +55,7 @@ namespace WebCore {
         DocLoader* m_docLoader;
         bool m_incremental;
         bool m_multipart;
-        bool m_shouldSkipCanLoadCheck;
+        SecurityCheckPolicy m_shouldDoSecurityCheck;
         bool m_sendResourceLoadCallbacks;
     };
 
diff --git a/WebCore/loader/SubresourceLoader.cpp b/WebCore/loader/SubresourceLoader.cpp
index 2ee4626..f92a074 100644
--- a/WebCore/loader/SubresourceLoader.cpp
+++ b/WebCore/loader/SubresourceLoader.cpp
@@ -61,18 +61,18 @@ SubresourceLoader::~SubresourceLoader()
 #endif
 }
 
-PassRefPtr<SubresourceLoader> SubresourceLoader::create(Frame* frame, SubresourceLoaderClient* client, const ResourceRequest& request, bool skipCanLoadCheck, bool sendResourceLoadCallbacks, bool shouldContentSniff)
+PassRefPtr<SubresourceLoader> SubresourceLoader::create(Frame* frame, SubresourceLoaderClient* client, const ResourceRequest& request, SecurityCheckPolicy securityCheck, bool sendResourceLoadCallbacks, bool shouldContentSniff)
 {
     if (!frame)
         return 0;
 
     FrameLoader* fl = frame->loader();
-    if (!skipCanLoadCheck && (fl->state() == FrameStateProvisional || fl->activeDocumentLoader()->isStopping()))
+    if (securityCheck == DoSecurityCheck && (fl->state() == FrameStateProvisional || fl->activeDocumentLoader()->isStopping()))
         return 0;
 
     ResourceRequest newRequest = request;
 
-    if (!skipCanLoadCheck
+    if (securityCheck == DoSecurityCheck
             && SecurityOrigin::restrictAccessToLocal()
             && !SecurityOrigin::canLoad(request.url(), String(), frame->document())) {
         FrameLoader::reportLocalLoadFailed(frame, request.url().string());
diff --git a/WebCore/loader/SubresourceLoader.h b/WebCore/loader/SubresourceLoader.h
index 1a94c73..907d917 100644
--- a/WebCore/loader/SubresourceLoader.h
+++ b/WebCore/loader/SubresourceLoader.h
@@ -28,7 +28,8 @@
 
 #ifndef SubresourceLoader_h
 #define SubresourceLoader_h
- 
+
+#include "FrameLoaderTypes.h"
 #include "ResourceLoader.h"
  
 namespace WebCore {
@@ -38,7 +39,7 @@ namespace WebCore {
     
     class SubresourceLoader : public ResourceLoader {
     public:
-        static PassRefPtr<SubresourceLoader> create(Frame*, SubresourceLoaderClient*, const ResourceRequest&, bool skipCanLoadCheck = false, bool sendResourceLoadCallbacks = true, bool shouldContentSniff = true);
+        static PassRefPtr<SubresourceLoader> create(Frame*, SubresourceLoaderClient*, const ResourceRequest&, SecurityCheckPolicy = DoSecurityCheck, bool sendResourceLoadCallbacks = true, bool shouldContentSniff = true);
 
         void clearClient() { m_client = 0; }
 
diff --git a/WebCore/loader/loader.cpp b/WebCore/loader/loader.cpp
index c98a2f0..a99bf87 100644
--- a/WebCore/loader/loader.cpp
+++ b/WebCore/loader/loader.cpp
@@ -117,10 +117,10 @@ Loader::Priority Loader::determinePriority(const CachedResource* resource) const
 #endif
 }
 
-void Loader::load(DocLoader* docLoader, CachedResource* resource, bool incremental, bool skipCanLoadCheck, bool sendResourceLoadCallbacks)
+void Loader::load(DocLoader* docLoader, CachedResource* resource, bool incremental, SecurityCheckPolicy securityCheck, bool sendResourceLoadCallbacks)
 {
     ASSERT(docLoader);
-    Request* request = new Request(docLoader, resource, incremental, skipCanLoadCheck, sendResourceLoadCallbacks);
+    Request* request = new Request(docLoader, resource, incremental, securityCheck, sendResourceLoadCallbacks);
 
     RefPtr<Host> host;
     KURL url(ParsedURLString, resource->url());
@@ -347,7 +347,7 @@ void Loader::Host::servePendingRequests(RequestQueue& requestsPending, bool& ser
         }
 
         RefPtr<SubresourceLoader> loader = SubresourceLoader::create(docLoader->doc()->frame(),
-            this, resourceRequest, request->shouldSkipCanLoadCheck(), request->sendResourceLoadCallbacks());
+            this, resourceRequest, request->shouldDoSecurityCheck(), request->sendResourceLoadCallbacks());
         if (loader) {
             m_requestsLoading.add(loader.release(), request);
             request->cachedResource()->setRequestedFromNetworkingLayer();
diff --git a/WebCore/loader/loader.h b/WebCore/loader/loader.h
index d0a526f..a9de032 100644
--- a/WebCore/loader/loader.h
+++ b/WebCore/loader/loader.h
@@ -24,6 +24,7 @@
 
 #include "AtomicString.h"
 #include "AtomicStringImpl.h"
+#include "FrameLoaderTypes.h"
 #include "PlatformString.h"
 #include "SubresourceLoaderClient.h"
 #include "Timer.h"
@@ -43,7 +44,7 @@ namespace WebCore {
         Loader();
         ~Loader();
 
-        void load(DocLoader*, CachedResource*, bool incremental = true, bool skipCanLoadCheck = false, bool sendResourceLoadCallbacks = true);
+        void load(DocLoader*, CachedResource*, bool incremental = true, SecurityCheckPolicy = DoSecurityCheck, bool sendResourceLoadCallbacks = true);
 
         void cancelRequests(DocLoader*);
         

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list