CmdUtils.getWindow() doesn't unwrap XPCNativeWrapper, so you can only 
access DOM methods/properties, not stuff that's defined by a script 
running in the content. To do that, you need to use the insecure method 
(which should only be used when absolutely needed).

- Blair




On 7/12/2008 11:31 AM, Fernando Takai wrote:
> Wouldn't be better to call getWindow instead of getWindowInsecure ?
>
> On Sat, Dec 6, 2008 at 8:29 PM, Blair McBride <[EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]>> wrote:
>
>
>     Try this:
>
>     var win = CmdUtils.getWindowInsecure();
>     win.myfunction();
>
>
>     Which is the same as:
>
>     var win =
>     Application.activeWindow.activeTab.document.defaultView.wrappedJSObject;
>     win.myfunction();
>
>
>
>     - Blair
>
>
>
>
>     On 22/11/2008 8:06 AM, Douglas Nogueira wrote:
>      > I'm trying to do this:
>      >
>      > myTab.focus()
>      > var string =
>      >
>     Application.activeWindow.activeTab.wrappedJSObject.document.myfunction();
>      > displayMessage(string);
>      >
>      >
>      > Don't show anything!!
>      >
>      > In the web site i have this in js:
>      >
>      > function myfunction(){
>      > return "oi";
>      > }
>      >
>      > There is something wrong? That is the only way to call js
>     functions in
>      > the current document ?
>      >
>      >
>      >
>      > 2008/11/8 rpl <[EMAIL PROTECTED]
>     <mailto:[EMAIL PROTECTED]> <mailto:[EMAIL PROTECTED]
>     <mailto:[EMAIL PROTECTED]>>>
>      >
>      >
>      > In firefox3 content DOM objects are wrapped with a XPCNativeWrapper
>      > interface for security reason:
>      >
>      > http://developer.mozilla.org/en/XPCNativeWrapper
>      >
>      > To access customized javascript functions (from the above link):
>      >
>      > If unsafe access to a property is required for some reason, this can
>      > be accomplished via the wrappedJSObject property of the wrapper.
>      >
>      >
>      > So you can try something like this:
>      >
>      >
>     
> Application.activeWindow.activeTab.wrappedJSObject.document.myfunction("hello
>      > world");
>      >
>      > Or something like this ;-)
>      >
>      > Happy Hacking,
>      > Luca Greco @ Alca Società Cooperativa
>      >
>      >
>      >
>      > >
>
>
>
>
>
> --
> Fernando "Takai"
> http://flickr.com/photos/supeertakai
> http://fernandotakai.jaiku.com
>
> Get Ubiquity: https://ubiquity.mozilla.com
>
> >

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"ubiquity-firefox" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/ubiquity-firefox?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to