Pete Collins

View: New views
3 Messages — Rating Filter:   Alert me  

Pete Collins

by Daniel Aquino :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hey a while back I asked about how to send paramters to window-watcher#windowOpen
You told you found an example on lxr something like

------------

  var string = Components.classes['@ mozilla.org/supports-string;1'].getService(Components.interfaces.nsISupportsString);
  args.data = new Array( 5 , 'c' , 'string' , {name:'what'} );

  return Components.classes["@ mozilla.org/embedcomp/window-watcher;1"]
                          .getService(Components.interfaces.nsIWindowWatcher)
                          .openWindow( refParent, strUrl, strWindowName, strWindowFeatures, args );

------------


The docs say to use a nsISupportsArray , so I have no idea why your example "actually" "does" "work"...
Although that example only lets me send a string...
The array passed into args.data appears to be a string as if using (new String()) in javascript...

I need ability to send any type of paramters...
At least a main javascript object that holds others paramters...

This is the common paradigm with window.openDialog and window.open
Usually you just create an object and pass it in and then access it via window.arguments[0]

If you can get any information would be great...
Thanks...



_______________________________________________
Jslib mailing list
Jslib@...
http://mozdev.org/mailman/listinfo/jslib

Re: Pete Collins

by Pete Collins :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


> This is the common paradigm with window.openDialog and window.open
> Usually you just create an object and pass it in and then access it
> via window.arguments[0]
>
> If you can get any information would be great...


You should just be able to pass in any js object as js objects by
default are considered type nsISupports which all interfaces inherit from.


var ww = Components.classes["@mozilla.org/embedcomp/window-watcher;1"]
                     .getService(Components.interfaces.nsIWindowWatcher);

var params = new Object;

openWindow( refParent, strUrl, strWindowName, strWindowFeatures, params);


--pete

--
Pete Collins - Founder, Mozdev Group Inc.
www.mozdevgroup.com
Mozilla Software Development Solutions
tel: 1-719-302-5811
fax: 1-719-302-5813

_______________________________________________
Jslib mailing list
Jslib@...
http://mozdev.org/mailman/listinfo/jslib

Re: Pete Collins

by Daniel Aquino :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

This is the same result I get for just about anything I pass in that gets auto converted by xpconnect...


===== Code =====

var tester = new Object;
tester.name = 'test';
tester.topic = 'test';

Components.classes["@mozilla.org/embedcomp/window-watcher;1"]
                     .getService( Components.interfaces.nsIWindowWatcher)
                     .openWindow( refParent, strUrl, strWindowName, strWindowFeatures, tester );

====  JS Shell ====

window.arguments
=> [xpconnect wrapped nsISupports]
window.arguments.toSource()
=> [{}]


_______________________________________________
Jslib mailing list
Jslib@...
http://mozdev.org/mailman/listinfo/jslib
LightInTheBox - Buy quality products at wholesale price