Changeset 56829 in webkit


Ignore:
Timestamp:
Mar 31, 2010 1:37:13 AM (14 years ago)
Author:
eric@webkit.org
Message:

2010-03-31 John Gregg <johnnyg@google.com>

Reviewed by Darin Fisher.

[chromium] add logging of cross-frame property accesses for site isolation
https://bugs.webkit.org/show_bug.cgi?id=35773

No new tests as no new functionality.

  • bindings/scripts/CodeGeneratorV8.pm:
  • bindings/v8/V8Utilities.cpp: (WebCore::logPropertyAccess):
  • bindings/v8/V8Utilities.h:
  • loader/FrameLoaderClient.h: (WebCore::FrameLoaderClient::logCrossFramePropertyAccess):

2010-03-31 John Gregg <johnnyg@google.com>

Reviewed by Darin Fisher.

[chromium] add logging of cross-frame property accesses for site isolation
https://bugs.webkit.org/show_bug.cgi?id=35773

  • public/WebFrameClient.h: (WebKit::WebFrameClient::logCrossFramePropertyAccess):
  • src/FrameLoaderClientImpl.cpp: (WebKit::FrameLoaderClientImpl::logCrossFramePropertyAccess):
  • src/FrameLoaderClientImpl.h:
Location:
trunk
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r56825 r56829  
     12010-03-31  John Gregg  <johnnyg@google.com>
     2
     3        Reviewed by Darin Fisher.
     4
     5        [chromium] add logging of cross-frame property accesses for site isolation
     6        https://bugs.webkit.org/show_bug.cgi?id=35773
     7
     8        No new tests as no new functionality.
     9
     10        * bindings/scripts/CodeGeneratorV8.pm:
     11        * bindings/v8/V8Utilities.cpp:
     12        (WebCore::logPropertyAccess):
     13        * bindings/v8/V8Utilities.h:
     14        * loader/FrameLoaderClient.h:
     15        (WebCore::FrameLoaderClient::logCrossFramePropertyAccess):
     16
    1172010-03-30  Gavin Barraclough  <barraclough@apple.com>
    218
  • trunk/WebCore/bindings/scripts/CodeGeneratorV8.pm

    r56445 r56829  
    675675    } elsif ($attribute->signature->extendedAttributes->{"CheckFrameSecurity"}) {
    676676        push(@implContentDecls, "    if (!V8BindingSecurity::checkNodeSecurity(V8BindingState::Only(), imp->contentDocument())) return v8::Handle<v8::Value>();\n\n");
     677    }
     678
     679    if ($attrExt->{"DoNotCheckDomainSecurity"} ||
     680        $attrExt->{"DoNotCheckDomainSecurityOnGet"}) {
     681        push(@implContentDecls, "    logPropertyAccess(name, info);\n");
    677682    }
    678683
     
    14471452         "#include \"V8BindingState.h\"\n" .
    14481453         "#include \"V8DOMWrapper.h\"\n" .
     1454         "#include \"V8Utilities.h\"\n" .
    14491455         "#include \"V8IsolatedContext.h\"\n\n" .
    14501456         "#undef LOG\n\n");
  • trunk/WebCore/bindings/v8/V8Utilities.cpp

    r56580 r56829  
    3434#include <v8.h>
    3535
     36#include "ChromiumBridge.h"
    3637#include "Document.h"
    3738#include "Frame.h"
     39#include "FrameLoaderClient.h"
    3840#include "ScriptExecutionContext.h"
    3941#include "ScriptState.h"
    4042#include "V8Binding.h"
     43#include "V8BindingState.h"
     44#include "V8DOMWindow.h"
    4145#include "V8Proxy.h"
    4246#include "WorkerContext.h"
     
    143147}
    144148
     149void logPropertyAccess(v8::Local<v8::String> name, const v8::AccessorInfo& info)
     150{
     151    Frame* target = V8DOMWindow::toNative(info.Holder())->frame();
     152    Frame* active = V8BindingState::Only()->getActiveWindow()->frame();
     153    if (target == active)
     154        return;
     155
     156    bool crossSite = !V8BindingSecurity::canAccessFrame(V8BindingState::Only(), target, false);
     157    String propName = toWebCoreString(name);
     158
     159    // For cross-site, we also want to identify the current event to record repeat accesses.
     160    unsigned long long eventId = 0;
     161    if (crossSite) {
     162        v8::HandleScope handleScope;
     163        v8::Handle<v8::Context> v8Context = V8Proxy::mainWorldContext(active);
     164        if (!v8Context.IsEmpty()) {
     165            v8::Context::Scope scope(v8Context);
     166            v8::Handle<v8::Object> global = v8Context->Global();
     167            v8::Handle<v8::Value> jsEvent = global->Get(v8::String::NewSymbol("event"));
     168            if (V8DOMWrapper::isValidDOMObject(jsEvent))
     169                eventId = reinterpret_cast<unsigned long long>(V8Event::toNative(v8::Handle<v8::Object>::Cast(jsEvent)));
     170        }
     171    }
     172    active->loader()->client()->logCrossFramePropertyAccess(target, crossSite, propName, eventId);
     173}
     174
    145175} // namespace WebCore
  • trunk/WebCore/bindings/v8/V8Utilities.h

    r56329 r56829  
    5757    ScriptExecutionContext* getScriptExecutionContext();
    5858
     59    void logPropertyAccess(v8::Local<v8::String> name, const v8::AccessorInfo& info);
     60
    5961    class AllowAllocation {
    6062    public:
  • trunk/WebCore/loader/FrameLoaderClient.h

    r56650 r56829  
    245245        virtual void didDestroyScriptContextForFrame() = 0;
    246246        virtual void didCreateIsolatedScriptContext() = 0;
     247
     248        virtual void logCrossFramePropertyAccess(Frame* target, bool crossOrigin, const String& name, unsigned long long eventId) { }
    247249#endif
    248250
  • trunk/WebKit/chromium/ChangeLog

    r56825 r56829  
     12010-03-31  John Gregg  <johnnyg@google.com>
     2
     3        Reviewed by Darin Fisher.
     4
     5        [chromium] add logging of cross-frame property accesses for site isolation
     6        https://bugs.webkit.org/show_bug.cgi?id=35773
     7
     8        * public/WebFrameClient.h:
     9        (WebKit::WebFrameClient::logCrossFramePropertyAccess):
     10        * src/FrameLoaderClientImpl.cpp:
     11        (WebKit::FrameLoaderClientImpl::logCrossFramePropertyAccess):
     12        * src/FrameLoaderClientImpl.h:
     13
    1142010-03-30  Gavin Barraclough  <barraclough@apple.com>
    215
  • trunk/WebKit/chromium/public/WebFrameClient.h

    r56728 r56829  
    285285    virtual void didCreateIsolatedScriptContext(WebFrame*) { }
    286286
     287    // Notifies that a cross-frame access was made to a property that allows
     288    // cross-origin access.
     289    virtual void logCrossFramePropertyAccess(WebFrame* active, WebFrame* target, bool crossOrigin, const WebString& property, unsigned long long eventId) { }
     290
    287291
    288292    // Geometry notifications ----------------------------------------------
  • trunk/WebKit/chromium/src/FrameLoaderClientImpl.cpp

    r56825 r56829  
    15061506}
    15071507
     1508void FrameLoaderClientImpl::logCrossFramePropertyAccess(Frame* target, bool crossOrigin, const String& name, unsigned long long eventId)
     1509{
     1510    m_webFrame->client()->logCrossFramePropertyAccess(m_webFrame, WebFrameImpl::fromFrame(target), crossOrigin, name, eventId);
     1511}
     1512
    15081513} // namespace WebKit
  • trunk/WebKit/chromium/src/FrameLoaderClientImpl.h

    r56070 r56829  
    200200    virtual void didNotAllowPlugins();
    201201
     202    virtual void logCrossFramePropertyAccess(
     203        WebCore::Frame* target,
     204        bool crossOrigin,
     205        const WebCore::String& name,
     206        unsigned long long eventId);
     207
    202208private:
    203209    void makeDocumentView();
Note: See TracChangeset for help on using the changeset viewer.