Changeset 77742 in webkit


Ignore:
Timestamp:
Feb 5, 2011 3:52:15 AM (13 years ago)
Author:
jochen@chromium.org
Message:

2011-02-05 Jochen Eisinger <jochen@chromium.org>

Reviewed by Adam Barth.

Add ContentSecurityPolicy object to Document and pass the X-WebKit-CSP header from the MainResourceLoader.
https://bugs.webkit.org/show_bug.cgi?id=53685

  • WebCore.xcodeproj/project.pbxproj:
  • dom/Document.h: (WebCore::Document::contentSecurityPolicy):
  • loader/MainResourceLoader.cpp: (WebCore::MainResourceLoader::didReceiveResponse):
  • page/ContentSecurityPolicy.cpp: (WebCore::ContentSecurityPolicy::didReceiveHeader):
  • page/ContentSecurityPolicy.h:
Location:
trunk/Source/WebCore
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r77741 r77742  
     12011-02-05  Jochen Eisinger  <jochen@chromium.org>
     2
     3        Reviewed by Adam Barth.
     4
     5        Add ContentSecurityPolicy object to Document and pass the X-WebKit-CSP header from the MainResourceLoader.
     6        https://bugs.webkit.org/show_bug.cgi?id=53685
     7
     8        * WebCore.xcodeproj/project.pbxproj:
     9        * dom/Document.h:
     10        (WebCore::Document::contentSecurityPolicy):
     11        * loader/MainResourceLoader.cpp:
     12        (WebCore::MainResourceLoader::didReceiveResponse):
     13        * page/ContentSecurityPolicy.cpp:
     14        (WebCore::ContentSecurityPolicy::didReceiveHeader):
     15        * page/ContentSecurityPolicy.h:
     16
    1172011-02-05  Eric Seidel  <eric@webkit.org>
    218
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r77578 r77742  
    31173117                97C078501165D5BE003A32EF /* SuffixTree.h in Headers */ = {isa = PBXBuildFile; fileRef = 97C0784F1165D5BE003A32EF /* SuffixTree.h */; };
    31183118                97C471DB12F925BD0086354B /* ContentSecurityPolicy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 97C471D912F925BC0086354B /* ContentSecurityPolicy.cpp */; };
    3119                 97C471DC12F925BD0086354B /* ContentSecurityPolicy.h in Headers */ = {isa = PBXBuildFile; fileRef = 97C471DA12F925BD0086354B /* ContentSecurityPolicy.h */; };
     3119                97C471DC12F925BD0086354B /* ContentSecurityPolicy.h in Headers */ = {isa = PBXBuildFile; fileRef = 97C471DA12F925BD0086354B /* ContentSecurityPolicy.h */; settings = {ATTRIBUTES = (Private, ); }; };
    31203120                97DCE20110807C750057D394 /* HistoryController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 97DCE1FF10807C750057D394 /* HistoryController.cpp */; };
    31213121                97DCE20210807C750057D394 /* HistoryController.h in Headers */ = {isa = PBXBuildFile; fileRef = 97DCE20010807C750057D394 /* HistoryController.h */; settings = {ATTRIBUTES = (Private, ); }; };
  • trunk/Source/WebCore/dom/Document.h

    r77333 r77742  
    3333#include "Color.h"
    3434#include "ContainerNode.h"
     35#include "ContentSecurityPolicy.h"
    3536#include "DOMTimeStamp.h"
    3637#include "DocumentOrderedMap.h"
     
    10901091    void initDNSPrefetch();
    10911092
     1093    ContentSecurityPolicy* contentSecurityPolicy() { return &m_contentSecurityPolicy; }
     1094
    10921095protected:
    10931096    Document(Frame*, const KURL& url, bool isXHTML, bool isHTML, const KURL& baseURL = KURL());
     
    13911394    int m_nextRequestAnimationFrameCallbackId;
    13921395#endif
     1396
     1397    ContentSecurityPolicy m_contentSecurityPolicy;
    13931398};
    13941399
  • trunk/Source/WebCore/loader/MainResourceLoader.cpp

    r75129 r77742  
    3232
    3333#include "ApplicationCacheHost.h"
     34#include "ContentSecurityPolicy.h"
     35#include "Document.h"
    3436#include "DocumentLoadTiming.h"
    3537#include "DocumentLoader.h"
     
    357359    }
    358360
     361    it = r.httpHeaderFields().find(AtomicString("x-webkit-csp"));
     362    if (it != r.httpHeaderFields().end()) {
     363        String content = it->second;
     364        m_frame->document()->contentSecurityPolicy()->didReceiveHeader(content);
     365    }
     366
    359367    // There is a bug in CFNetwork where callbacks can be dispatched even when loads are deferred.
    360368    // See <rdar://problem/6304600> for more details.
  • trunk/Source/WebCore/page/ContentSecurityPolicy.cpp

    r77411 r77742  
    3333}
    3434
     35void ContentSecurityPolicy::didReceiveHeader(const String& header)
     36{
     37    m_header = header;
    3538}
     39
     40}
  • trunk/Source/WebCore/page/ContentSecurityPolicy.h

    r77411 r77742  
    3535public:
    3636    ContentSecurityPolicy();
     37
     38    void didReceiveHeader(const String&);
     39
     40private:
     41    String m_header;
    3742};
    3843
Note: See TracChangeset for help on using the changeset viewer.