Re: [pyxpcom] queryInterface, browser, python and xul
by Shane Caraveo other posts by this author
Jul 1 2007 10:06PM messages near this date
view in the new Beta List Site
Re: [pyxpcom] queryInterface, browser, python and xul
|
[pyxpcom] how to get a nsIWeakReference in pyxpcom?
LoadURI is in fact implemented in XBL with JavaScript, see
http://lxr.mozilla.org/seamonkey/source/toolkit/content/widgets/browser.xml#138
Shane
Mark Hammond wrote:
> It may be that the method you want is not defined in an IDL file at all, but
> with custom code supporting only JS. For example, to implement an
> openDialog() method, I ended up with code:
>
> svc = components.classes['@mozilla.org/embedcomp/window-watcher;1']
> > .getService(components.interfaces.nsIWindowWatcher)
> # Wrap in an nsIArray with special support for Python being able to
> # access the raw objects if the call-site is smart enough
> args = _nsdom.MakeArray(args)
> ret = svc.openWindow(self._comobj_, url, name, features, args)
> # and re-wrap in one of our "dom" objects
> ...
>
> Although this relies on features only in the nsdom code, the underlying
> point is that you may be able to convince the window-watcher to do what you
> need, but sadly I've no time to dig deeper into this today...
>
> Cheers,
>
> Mark
>
> > Hello.
> > Spent last night trying to figure out how to port mybrowser (
> > http://benjamin.smedbergs.us/xulrunner/mybrowser-0.2.2.xulapp ) from
> > JavaScript to Python.
> > It fails at LoadURI() - AttributeError: XPCOM component
> > '<unknown>' has
> > no attribute 'LoadURI'
> > I tried to get all available interfaces and blindly query
> > browser for them:
> >
> > browser = document.getElementById("browser")
> > for name, iid in components.interfaces.items():
> > try:
> > browser.queryInterface(iid)
> > dump(str(name)+'\n')
> > except:
> > donothing()
> >
> > Here is what i got:
> >
> > nsISupportsWeakReference
> > nsIObserver
> > nsIDOMXULElement
> > nsIDOM3Node
> > nsIDOM3EventTarget
> > nsIDOMEventTarget
> > nsIAccessibleProvider
> > nsIDOMNSEventTarget
> > nsIDOMElementCSSInlineStyle
> > nsIDOMNode
> > nsIDOMEventListener
> > nsIDOMNSElement
> > nsIClassInfo
> > nsISupports
> > nsIDOMElement
> >
> > Checked all of them, and it seems that none is capable of
> > anything that
> > browser is supposed to do (like, loading URI).
> > So...this is not implemented, or it's just my poor
> > Python/XPCOM skills?
> > _______________________________________________
> > pyxpcom mailing list
> > pyxpcom@[...].com
> > To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
> >
>
> _______________________________________________
> pyxpcom mailing list
> pyxpcom@[...].com
> To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
_______________________________________________
pyxpcom mailing list
pyxpcom@[...].com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Thread:
Lord Ruslan Nightmare
Mark Hammond
Shane Caraveo
|