Access inner Window object

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Access inner Window object

James A. Overton
Now that there is a difference between inner and outer window objects
(https://bugzilla.mozilla.org/show_bug.cgi?id=296639), is there a way
to gain access to the inner window object from the outside? I realize
that the point of the change is to prevent this in general, but perhaps
there is a way for privileged scripts to gain access?
Specifically, I am wondering if privileged JavaScript running in the
browser's XULDocument can manipulate the Window object accessed by
document.commandDispatcher.focusedWindow (e.g. adding properties to it)
so that JavaScript inside that window can see the changes.
Thanks,

James

_______________________________________________
mozilla-dom mailing list
[hidden email]
http://mail.mozilla.org/listinfo/mozilla-dom
Reply | Threaded
Open this post in threaded view
|

Re: Access inner Window object

Boris Zbarsky
James A. Overton wrote:
> is there a way to gain access to the inner window object from the outside?

No.

> Specifically, I am wondering if privileged JavaScript running in the
> browser's XULDocument can manipulate the Window object accessed by
> document.commandDispatcher.focusedWindow (e.g. adding properties to it)
> so that JavaScript inside that window can see the changes.

Setting a property on the outer window object forwards the set to the current
inner.  In other words, what you said you want to do should Just Work.

On the other hand, given your setup chances are you're actually talking about
XPCNativeWrapper, not the inner/outer split.  See
<http://developer.mozilla.org/docs/XPCNativeWrapper>.  In that case, you can get
the wrappedJSObject of the wrapper and set the property.  But the whole point of
XPCNativeWrapper is to NOT access the content JSObject from chrome, since doing
so is a security hole.  That is, by setting a property you are calling a getter
which content can override, with the result that you can end up doing random
things you didn't expect to.  We _think_ you won't do these random things with
chrome privileges, but that's a risk you'd take.

-Boris
_______________________________________________
mozilla-dom mailing list
[hidden email]
http://mail.mozilla.org/listinfo/mozilla-dom
Reply | Threaded
Open this post in threaded view
|

Re: Access inner Window object

James A. Overton
You are quite right! Thank you for explaining that.

James

_______________________________________________
mozilla-dom mailing list
[hidden email]
http://mail.mozilla.org/listinfo/mozilla-dom