[webkit-dev] Question about Constructors in WebKit JS Bindings

Drew Wilson atwilson at google.com
Tue Jul 7 17:33:06 PDT 2009


On Tue, Jul 7, 2009 at 5:25 PM, Adam Barth <abarth at webkit.org> wrote:

>
> I'd have to look at the code a bit more to know whether this is
> correct.  Where does |globalObject| come from?


It comes from the JSDOMWindow object where that constructor is exposed. Case
in point:

#if ENABLE(CHANNEL_MESSAGING)
JSValue JSDOMWindow::messageChannel(ExecState* exec) const
{
    return getDOMConstructor<JSMessageChannelConstructor>(exec, *this*);
}
#endif

So, when you first access someWindow.MessageChannel it should create a
JSMessageChannelConstructor whose prototype property is derived from
someWindow, then cache it in someWindow.

I'll run some tests as you suggest.


>
> For an added bonus, you should test what happens if you transplant the
> constructor from one window to another.  The constructor should keep
> its original prototype chain.
>
> Adam
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20090707/87915c3f/attachment.html>


More information about the webkit-dev mailing list