Bug 27662

Summary: Document needs a JSDOMWindow pointer that doesn't require going through Frame
Product: WebKit Reporter: Eric Seidel <eric@webkit.org>
Component: HTML DOMAssignee: Nobody <webkit-unassigned@lists.webkit.org>
Status: RESOLVED INVALID    
Severity: Normal CC: abarth@webkit.org, ap@webkit.org, loic@dachary.org
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: PC   
OS: Mac OS X 10.5   
Bug Depends on: 27640    
Bug Blocks: 26147    

Description From 2009-07-24 12:14:55 PST
Document needs a JSDOMWindow pointer that doesn't require going through Frame

This is needed for times in the bindings where we have a Node* or a Document* and we need to get the globalObject so that we can correctly call toJS().

NodeFilterConditionCustom.cpp acceptNode() is one such example.

Relating this to bug 27640 which is the inverse of this mapping.
------- Comment #1 From 2011-10-05 07:10:53 PST -------
Hi,

I think this bug is related to bug 26147 . I'm trying to fix it and I would appreciate if you have an advice on how to proceed. Do you think it should be an additional field to the Document class ? If so do you think it should be set when the Document constructor is called or attached to it later on ? 

There are many approach to this problem and any kind of guidance would be most appreciated. 

Cheers
------- Comment #2 From 2011-10-05 10:38:52 PST -------
We solved this problem a different way.
------- Comment #3 From 2011-10-05 15:10:25 PST -------
(In reply to comment #2)
> We solved this problem a different way.

The chosen solution is incorrect.
------- Comment #4 From 2011-10-05 15:13:51 PST -------
(In reply to comment #3)
> (In reply to comment #2)
> > We solved this problem a different way.
> 
> The chosen solution is incorrect.

Could you provide a bit more context as to what the solution was and why you believe it's incorrect?  (Although I filed this bug, I haven't worked in this area in a long time.)
------- Comment #5 From 2011-10-05 15:15:26 PST -------
The reason this bug is invalid is because Document is a DOM-layer object and JSDOMWindow is a bindings-layer object.  It's generally not a good idea to have a DOM-layer object have a pointer to a bindings-layer object.  Instead, we ended up storing the pointer in the JSDocument wrapper object, which is a bindings-layer object.
------- Comment #6 From 2011-10-06 01:22:15 PST -------
Thanks for explaining, now I understand. I'm still unsure if this will help in the context of bug 26147, but it's a different topic.