[Webkit-unassigned] [Bug 93646] Refactor V8 bindings to allow content scripts to access subframes

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Aug 27 11:55:55 PDT 2012


https://bugs.webkit.org/show_bug.cgi?id=93646





--- Comment #8 from Adam Barth <abarth at webkit.org>  2012-08-27 11:55:55 PST ---
(From update of attachment 160690)
View in context: https://bugs.webkit.org/attachment.cgi?id=160690&action=review

> Source/WebCore/bindings/v8/ScriptController.cpp:338
> +    m_isolatedWorlds.set(worldId, isolatedWorldShell.get());

Can we key m_isolatedWorlds off of DOMWrapperWorld rather than worldId?  I'd like to remove the concept of worldId from WebCore eventually and have that just be a concern of the WebKit-layer (i.e., code in Source/WebKit/chromium).

> Source/WebCore/bindings/v8/ScriptController.cpp:443
> +            isolatedShell = windowShell(isolatedShell->world());
> +            // FIXME: need to set security token here
> +            isolatedShell->initContextIfNeeded();

For example, this work can be in a separate patch.  This is a big behavior change, and it would be nice to make that change separately from all the refactorings that make it possible.

> Source/WebCore/bindings/v8/ScriptController.h:69
>      V8DOMWindowShell* windowShell() const { return m_windowShell.get(); }

We probably want to delete this function and have all the callers use windowShell(mainWold()) or whatever.

> Source/WebCore/bindings/v8/V8DOMWindowShell.cpp:90
> +static v8::Handle<v8::Object> getGlobalObject(v8::Handle<v8::Context> context)
> +{
> +    return v8::Handle<v8::Object>::Cast(context->Global()->GetPrototype());
> +}

getGlobalObject is a bit of a misnomer.  How about toInnerGlobalObject(v8::Handle<v8::Context>)

> Source/WebCore/bindings/v8/V8DOMWindowShell.cpp:97
> +V8DOMWindowShell* V8DOMWindowShell::isolatedWorldContext()

This function should have the term "entered" in its name somewhere because it's calling v8::Context::GetEntered

> Source/WebCore/bindings/v8/V8DOMWindowShell.cpp:220
> +    : m_frame(frame),
> +      m_world(world),

These commas go on the next line under the ":".  See Other Punctuation in http://www.webkit.org/coding/coding-style.html

> Source/WebCore/bindings/v8/V8DOMWindowShell.cpp:298
> +static void isolatedContextWeakCallback(v8::Persistent<v8::Value> object, void* parameter)
> +{
> +    object.Dispose();
> +    reinterpret_cast<V8DOMWindowShell*>(parameter)->deref();
> +}
> +
> +static void registerWeakHandler(v8::Handle<v8::Context> context, V8DOMWindowShell* shell)
> +{
> +    v8::Persistent<v8::Context>::New(context).MakeWeak(shell, isolatedContextWeakCallback);
> +    shell->ref();
> +}

Can we hold this Persistent handle as a ScopedPersistent on V8DOMWindowShell ?  Doesn't it already have a ScopedPersistent to a v8::Context?

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


More information about the webkit-unassigned mailing list