[whatwg] Window and WindowProxy

Ian Hickson ian at hixie.ch
Thu Aug 8 11:50:56 PDT 2013


On Thu, 8 Aug 2013, Boris Zbarsky wrote:
> On 8/8/13 7:22 AM, Boris Zbarsky wrote:
> > On 8/8/13 2:11 AM, Ian Hickson wrote:
> > > I would imagine most languages other than JavaScript would break 
> > > that invariant.
> > 
> > Why are we suddenly worrying about languages other than JavaScript?
> 
> Let me try that with less snark.
> 
> I believe that WindowProxy is solving an issue specific to the 
> JavaScript bindings for the web platform: an issue caused by conflating 
> "the object representing the current page" and "the object representing 
> a given navigation context".
> 
> If I were creating bindings for the web platform in another language, or 
> for that matter green-field designing JS bindings, I would simply expose 
> those as two separate objects, with a "get the current page" getter on 
> the navigation context and a "get the navigation context" getter on the 
> object representing a page.
> 
> So I'm not terribly worried about how other languages will deal with 
> WindowProxy, because I don't really expect them to have a WindowProxy. 
> And I'm not terribly worries about how they will deal with indexed 
> access on a Window, because I don't expect them to do such a thing at 
> all in their bindings... Just like I don't expect other languages to 
> have a global scope polluter.

I'd go further -- I wouldn't expose WindowProxy to other languages at all, 
personally. I would just make every attribute that returns a WindowProxy 
return whatever the current Window is, or some such. Or alternatively, 
have WindowProxy just defined as:

   interface WindowProxy {
     readonly attribute Window currentWindow;
   };

...but that seems like it'd make the API unnecessarily ugly.

My point is that either way, if we do this, that means all the security 
checks have to be on Window, not WindowProxy.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'



More information about the whatwg mailing list