Ubiquity view into state of other Firefox extensions (XPCOM)

0 views
Skip to first unread message

Dan Brickley

unread,
Nov 15, 2008, 1:14:59 PM11/15/08
to ubiquity...@googlegroups.com, Tim Berners-Lee, Oshani Seneviratne
cutting this over from irc:irc.mozilla.org/ubiquity


Hi folks. I need some ubiquity/moz clues: is there an easy way to wire
things up so that Ubiquity can access the state of another running
Firefox extension? Specifically I want to make a Ubiquity view into the
http://www.w3.org/2005/ajar/tab (and we can make changes to tabulator to
facilitate this if needed, i'm sure).

I guess this would involve the extension exposing an XP-COM API?
Something along the lines of
https://developer.mozilla.org/en/How_to_Build_an_XPCOM_Component_in_Javascript

Context: the tabulator extension will scoop up and aggregate all kinds
of interesting data as you wander around the Web. And it has its own
HTML UI. But I'd like also to make a commandline Ubiquity view into the
data it collects. Since this is all in-memory in .js, a Ubiquity script
would need some API into the state of the running extension. From all I
know about Moz, XPCOM is the only way to do this. Am I right in thinking
that Ubiquity scripts all still have Chrome privileges and could
therefore call any XPCOM API we expose?

thanks for any pointers,

cheers,

Dan

ps. nearby in the Web - http://code.google.com/p/rdfquery/wiki/RdfPlugin
- same data but exposed through jquery-based API.

--
http://danbri.org/

Blair McBride

unread,
Nov 15, 2008, 4:15:15 PM11/15/08
to ubiquity...@googlegroups.com
Using a custom XPCOM component is one way of achieving this, although
its not the only way. Assuming the other extension overlays onto
browser.xul, once you access the window object, you can access any
functions/objects that the other extension defines.

The following snippet will give you the main browser window object:

var chromeWindow =
Components.classes["@mozilla.org/appshell/window-mediator;1"]
.getService(Components.interfaces.nsIWindowMediator)
.getMostRecentWindow("navigator:browser");



Then, assuming the other extension has an object named TabularData, and
assuming its overlayed onto browser.xul, you can access it via:

chromeWindow.TabularData



This way, you shouldn't (generally) need to alter anything in the other
extension to get this working. Which is a lot easier than creating a new
custom XPCOM component.

- Blair
Reply all
Reply to author
Forward
0 new messages