Java code in Firefox for Android addons

All timestamps are based on your local time of:

Posted by: stak
Tags: mozilla
Posted on: 2012-10-11 13:00:53

With the new "native Fennec" (aka Firefox for Android, v14 or higher), the UI is built using standard Android widgets and components. While this makes the browser much faster to start up and better integrated with Android, it also has a disadvantage: add-on authors are much more limited in what they can do with the Firefox UI. We currently have a few APIs, exposed to JS via the NativeWindow object, that allow add-on authors to interact with the UI. However, this is a far cry from what can be done with desktop Firefox or the older "XUL Fennec".

Recently, I put together a proof-of-concept that allows add-ons to bundle Java code into their Firefox for Android add-on and run it on demand (see bug 794479). In theory, this will allow add-on authors to provide much deeper integration with the UI. However, as with all add-on APIs, we need to be very careful with what we expose and how we allow authors to use it, so that we balance the functionality provided with how much we are constrained from changing things in the future.

I am interested in hearing from anybody, but add-on authors in particular, to see what kind of use cases they would like to see supported, so that we can see if (1) exposing such an API is worthwhile at all, and (2) what kind of functionality we should provide if we do expose the API. Please comment on this post or in bug 799631 with any thoughts you have on the topic. Thanks!

Posted by Cesar at 2012-10-11 15:00:42
This is great. I gave up on porting my extension (safe) for firefox mobile because part of it's functionality is changing the tab colour - which isn't possible.

Though, I don't know how useful it would be to other add-on authors :)
[ Reply to this ]
Posted by Erik at 2012-10-11 18:56:30
I say this as primarily a user and an occasional developer of user scripts: I am worried that allowing what is essentially "native code" to be injected into the running Firefox that we'll be bringing the biggest problem with desktop Firefox to the mobile world, namely that badly behaved add-ons mar Firefox's reputation. But I understand that this is really a replacement for XUL, not extension JS so perhaps my worries are unfounded.
[ Reply to this ]
Posted by Caspy7 at 2012-10-12 22:24:29
Acknowledging very little understanding of what is going on in the code, I'm curious if this would have the potential to introduce new vectors for security issues?
[ Reply to this ]
Posted by stak at 2012-10-13 06:44:29
It's possible, yes. We are also requesting a security review of this functionality.
[ Reply to this ]
Posted by anonymous at 2012-10-13 08:51:21
For me, this is disappointing. We should be making add-ons more "webby", if anything. Allowing platform-specific code of a new kind in there goes absolutely in the wrong direction in my eyes. :(
[ Reply to this ]
Posted by at 2012-10-16 06:27:17
You dropped support for add icons on fennec's toolbars in version 15 I guess this is the reason, is there any way to do this at the moment? Via java code or whatever, thanks!
[ Reply to this ]
Posted by stak at 2012-10-16 17:37:30
Yes, this is why we dropped support for that in version 14. Currently there is no way to modify the Firefox UI, other than adding menu items via the NativeWindow interface. However it's good to know that you are interested in this behaviour, we will take it into account when deciding whether or not the expose this functionality. Thanks!
[ Reply to this ]
Posted by don at 2012-10-24 00:23:52
I'd like the ability to create JellyBean expandable notifications that can control the web app in Firefox (similar to the play, pause,ffw buttons for a music player). You could put custom buttons/images/text in the notification and set callbacks for actions on them.

Ability to read from the filesystem (assuming the user gives the OK with an access request) so I could build a full music player app or other type of app that works with the files on the device.

Allowed expansions in comments/replies: [i]italic[/i], [u]underline[/u], [b]bold[/b], [code]code[/code], [sub]subscript[/sub], [sup]superscript[/sup], [url=http://some.url]linked text[/url]
Human verification: Sum of twelve and thirteen =
Posted by paa at 2012-10-24 07:27:18
I think it would be useful (at least for tablets) to be able to add a tab next to Top Sites, Bookmarks and History.

The obvious use case is the integration of online bookmarking services
[ Reply to this ]

[ Add a new comment ]

(c) Kartikaya Gupta, 2004-2021. User comments owned by their respective posters. All rights reserved.
You are accessing this website via IPv4. Consider upgrading to IPv6!