Closed
Bug 619259
Opened 14 years ago
Closed 12 years ago
Should be able to use windowwatcher's openWindow and pass js-object arguments
Categories
(Core :: XPConnect, defect)
Core
XPConnect
Tracking
()
RESOLVED
DUPLICATE
of bug 460296
People
(Reporter: asaf, Unassigned)
Details
Within the context of a JS components or a JS module, the non-hacky way (and sometimes, the only way) to open a window is to use nsIWindowWatcher's openWindow. However, this methods takes the window arguments as an nsISupportsArray. Apart the complexity of wrapping each argument in some supports-wrapper, and then appending it to a supports array, this wrapping makes it impossible to pass JS Objects for window.arguments. Naively I though that nsIVariant would do the trick somehow. It doesn't. XPConnect wraps the JS Object as an nsISupports (probably at the time setFromVariant(nsIVariant) is called), and when window.arguemnts is accessed, the (quite useless) supports object is exposed in window.arguments. The only workaround I found is to "implement" wrappedJSObject in the object, and unwrap it later. I suppose one way to fix this is to add a JS-friendly version of openWindow to nsIWindowWatcher.
Comment 1•14 years ago
|
||
How is that supposed to work if the resulting window is not implemented in JS itself? Seems like if you happen to know that in your particular case both the caller and callee will be JS then the wrappedJSObject approach is in fact the right one....
Reporter | ||
Comment 2•14 years ago
|
||
Maybe window-watcher is not the right place for this api. My actual request here is pretty simple: Have an api similar to window.open in non-window contexts. [In fact, does window.open guarantee anything that windowwatcher doesn't]
Reporter | ||
Comment 3•14 years ago
|
||
Also, I'm almost sure that by using a nsIVariant I could pass a JS array as an argument. Couldn't we wrap other js objects in the same manner?
Updated•12 years ago
|
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → DUPLICATE
You need to log in
before you can comment on or make changes to this bug.
Description
•