[webkit-dev] document()->frame()->script()->globalObject()

Eric Seidel eric at webkit.org
Thu Jul 23 17:56:27 PDT 2009

Yes, sorry to be confusing.  I was attempting to provide examples of
how we currently go through the frame() every time we need the

It sounds like you agree with me, that the Document should have a way
to get to the JSDOMGlobalObject w/o having to go through the Frame.
Am I understanding correctly?

Currently Document owns the DOMWindow.  However there is no way to get
from DOMWindow* to JSDOMWindow* w/o going through the Frame.


On Thu, Jul 23, 2009 at 5:50 PM, Maciej Stachowiak<mjs at apple.com> wrote:
> On Jul 23, 2009, at 5:38 PM, Eric Seidel wrote:
>> I'm trying to get a JSDOMGlobalObject from a Node*.  A Node* should
>> always have one, but our current path through Frame* can sometimes
>> fail.
> Right - what confuses me is that you posted the toJS() function for
> DOMWindow, where there's no document or node involved. It does go through
> the frame, but that's to convert properly to the outer window, which is what
> you should get when you expose a window object to JS. I think it's
> reasonable for a document to know about its innner window, in our current
> design.
>  - Maciej
>> -eric
>> On Thu, Jul 23, 2009 at 5:33 PM, Maciej Stachowiak<mjs at apple.com> wrote:
>>> On Jul 23, 2009, at 5:23 PM, Eric Seidel wrote:
>>> It seems all lookups of the current globalObject go through the frame.
>>> document()->frame()->script()->globalObject() is one example.
>>> Another:
>>> JSValue toJS(ExecState*, DOMWindow* domWindow)
>>> {
>>>   if (!domWindow)
>>>       return jsNull();
>>>   Frame* frame = domWindow->frame();
>>>   if (!frame)
>>>       return jsNull();
>>>   return frame->script()->windowShell();
>>> }
>>> Why?  Shouldn't the Document know what its JSDOMGlobalObject is,
>>> regardless of whether its currently in a Frame or not?
>>> The document should probably know its own inner window object, while the
>>> frame should hold on to the outer window. I'm not entirely clear on how
>>> the
>>> document relates to the code you quoted though.
>>>  - Maciej

More information about the webkit-dev mailing list