views:

97

answers:

2

I have written a Firefox extension that catches when a particular URL is entered and does some stuff. My main app launches Firefox with this URL. The URL contains sensitive information so I don't want it being stored in the history.

I'm concerned about the case where the extension is not installed. If its not installed and Firefox gets launched with the sensitive URL, it will get stored in history and there's nothing I can do about it. So my idea is to use a bookmarklet.

I will launch Firefox with "javascript:window.location.href='pleaseinstallthisplugin.html'; sensitiveinfo='blahblah'".

If the extension is not installed they will get redirected to a page that tells them to install it and the sensitive info won't get stored in the history. If the extension IS installed it will grab the information in the sensitiveinfo variable and do its thing.

My question is, can the bookmarklet call a method in the extension to pass the sensitive info (and if so, how) or can the extension catch when javascript is being called in the bookmarklet?

How can a bookmarklet and Firefox extension communicate?

p.s. The alternative means of getting around this situation would be for my main app to launch Firefox and communicate with the extension using sockets but I am loath to do that because I've run into too many issues over the years with users with crazy firewalls blocking socket communication. I'd like to do everything without sockets if possible.

A: 

As far as I know, bookmarklets can never access chrome files (extensions).

Marwan Aouida
A: 

Bookmarklets are executed in the scope of the current document, which is almost always a content document. However, if you are passing it in via the command line, it seems to work:

/Applications/Namoroka.app/Contents/MacOS/firefox-bin javascript:alert\(Components\)

Accessing Components would throw if it was not allowed, but the alert displays the proper object.

sdwilsh
Although you can access the Components object it looks like trying to access any useful method/property on that object such as classes or QueryInterface() gets your permission denied. So I guess it's just not possible.
mhenry1384