Firefox Mobile – A Few Add-ons

In addition to working on Firefox Mobile, I like to tinker around with building add-ons too. Not surprising I guess, since I seem to go on and on about how to build them.

Anyway, I have a few add-ons that you might find useful – either installed in Firefox Mobile or as examples you can rip apart and use to build your own add-ons.

Mobile Tools

Mobile Tools is a collection of a few utilities that might be useful when debugging mobile webpages. You’ll find commands for viewing page source and basic page info. Both open in new tabs. Page source shows the web page’s raw HTML content. You can zoom and pan through the source just like any other web page. Page info shows some simple bits of information about the web page:

Mobile Tools also supports window.console a little better than the built-in native support, including:

  • String formatting in logging methods (%s, %d, %i, %f)
  • dir and dirxml
  • Simplified trace
  • group and groupEnd
  • time and timeEnd

Start Page Plus

The built-in start page, Firefox Start, is pretty, loads fast and has some nice features. We can always add more! Start Page Plus adds a few sections to the standard Firefox Start page:

  • Favorites: A list of bookmarks you want displayed on the start page. Just tag a bookmark with “start” and it appears on the start page.
  • Local Search: Quickly find various types of places near you with a simple tap. Includes food, hotels, gas, movie theaters and your own location – shown on Google Maps. This feature does use the built-in geolocation feature.
  • Local Twitter: Shows tweets happening near you. You don’t need to be logged into Twitter. The stream is based on your location.

Use the add-on options to show and hide sections as well as move them around the page. You can also set the zone used to pull in tweets from Twitter.

Firefox Mobile and window.console Support

Desktop Firefox added native support for a subset of the window.console API. It’s a subset in that only the following API methods are supported:

  • console.log(arguments)
  • console.info(arguments)
  • console.warn(arguments)
  • console.error(arguments)

Also, the Firebug string formatting features are not supported yet.

Last night we turned on basic support in Firefox Mobile too. It’s basic in the sense that the window.console is merely forwarded to the Error Console.

Mobile Add-on Development

I was part of this year’s Add-on Con event, presenting some information on building add-ons for Firefox Mobile. Learning how to work in multiple processes can be tricky at first, but once you get used to working with messages, it gets easier. The information was also relevant for Firefox Desktop, since multiple processes will show up there in a future release. Felipe Gomes is working very hard on getting that project jump started.

In addition to the presentation, I made some video tutorials on building Firefox Mobile add-ons, including a multi-process add-on. Fellow Mozillian, Sara Yap, encouraged me to add some code to the page to allow subtitling. I am excited to see how that works out.

Mozilla is currently running a contest for mobile add-ons – The Firefox Mobile Add-ons Cup. Get your add-on entered as soon as possible. Join Mozilla IRC (#mobile or #mobileaddons) if you have questions about building your add-on.

Firefox Mobile keeps getting better and better. I recently acquired a Samsung Galaxy Tab and I have to say, Firefox is awesome on the Tab.

Add-on Training at Add-on Con

I’ll be taking part in the Training Day portion of Add-on Con this year. Firefox Mobile has made the jump to a multi-process architecture and many aspects of add-on development have changed. Sure, this could be a little scary. Yes, you will need to learn some new tricks. Of course, we’ll be here to help you. My session at Add-on Con will be all about building add-ons that work in a multi-process architecture.

As a developer on the Front-end team of Firefox Mobile, I can tell you that we had to go through the same kind of code changes. Check out some documentation we have for working with multi-process. I’ve also started to build some video tutorials on the subject too. They won’t win any Oscar’s, but might give you a better understanding of what’s changing.

Even if building add-ons for Firefox Mobile isn’t your cup of tea, it’s probably a good idea to pay attention. Rumor has it that desktop Firefox is moving to multi-process soon too.

Hope to see you at Add-on Con. Don’t forget the Mozilla Party!

Fennec 4.0 – New and Notable

Just Too Damn Good to be a Version 2.0

in case you haven’t heard yet, Firefox for mobile (Fennec) is bumping it’s version numbering to more closely match desktop releases of Firefox. This means “Firefox 2.0b1 for Android & Maemo” is becoming “Firefox 4.0b1 for Android & Maemo” and will be released as “Firefox 4 for Android and Nokia N900“. We are aligning mobile Firefox and desktop Firefox since the web rendering engines used in both browsers are the same. Treating them as the same version seemed like the right thing to do.

Any add-ons hosted on addons.mozilla.org (AMO) that are marked as compatible for Fennec 2.0b1pre will automatically be bumped to support Fennec 4.0b1pre. If your add-on worked in Fennec 2.0b1pre, it will work fine in Fennec 4.0b1pre.

Goodbye Tiles, Hello Browser

Desktop Firefox uses a XUL to display web content. The user manipulates the browser element when clicking, scrolling, dragging or typing. The same was not true in Fennec. In order to achieve acceptable panning and zooming performance, Fennec 1.0 started using a set of tiles to render the web content – which was still loaded into hidden elements. It was a complex system with many quirks to go along with the performance improvements.

Thankfully, a lot of platform work in graphics, layout and multi-process has happened since Fennec 1.0 and recently we removed the tiles and switched back to use only elements to render web content. The front-end code is much cleaner and more simple. In addition, it’s much faster than the previous code so panning and zooming are even better than before.

Go try a nightly release for yourself: Android or Maemo

Note to the faint of heart: Nightly release contain bugs – don’t be frightened when you encounter them. Tell us about them instead!

Fennec 2.0 – New and Notable

It’s been a while since I posted about news things happening in Fennec and now I have a backlog! Let’s jump right into the list of new features you’ll find in the Fennec 2.0 nightlies:

  • Awesomescreen: The Awesomebar Awesomescreen redesign merges the existing Search and Bookmark UIs while adding History and Desktop (via Sync) into a single UI. It’s part of our goal to keep data close to you when you need it. The Awesomescreen is all about helping you navigate to the pages you want, as fast as you can.
  • Moved Search Providers: The list of search providers was moved from the bottom of the Awesomescreen results to a button on the right side of the URL bar. This was done to maximize the available space fro the Awesomescreen results.
  • SiteMenu and ContextMenu APIs: We made it a lot easier for add-ons to extend the SiteMenu and ContextMenu by adding real APIs around the functionality.
  • Awesomescreen Badging: We added the ability to “badge” URLs shown in the Awesomescreen with helpful meta data, like unread inbox counts. We also added an API to the feature so add-ons could add badging to any URL (website), not just the ones we built into Fennec.
  • More Context Menus: We added support for more context menus (long tap menus) in places like Bookmark list, Awesomescreen results and the element in web content.
  • Android Notifications: We use the native notification system on Android for things like downloads, add-on installations and application updates.
  • Right-to-Left Support: We made the Fennec support RTL locales much better than it did, and we also want to make sure we don’t break RTL locales as we land new features.

Fennec 2.0 – Now with Firefox Sync Builtin

The Mozilla Labs team has been working very hard to move the core part of Firefox Sync (nee Weave Sync) into the main Mozilla source repository. They finished a few days ago. Now any Mozilla application can start to use the core features of Firefox Sync without requiring the user to install an add-on. The system is built right into the application.

The Mobile team integrated the basic user interface for Firefox Sync directly into Fennec. Now you can synchronize your tabs, history, bookmarks, form data and passwords – desktop to mobile device and back again – without installing an add-on!

If you’re using a nightly Fennec 2.0a1pre build, take a look in the preferences area for the Sync settings. We’re not finished yet. Plans for Fennec 2.0 include re-organizing the UI for accessing remote-synced tabs.

Fennec 2.0: What’s Coming

We haven’t even released the final Firefox for Maemo 1.1 yet, but we have been very busy working on features and changes for the next major release. Check out the Fennec 2.0 project planning page.

The biggest changes are related to out-of-process web content (Project Electrolysis) and accelerated rendering (Project Layers). Significant amounts of platform work have been done on both projects. Fennec 2.0 will integrate both Electrolysis and Layers.

Electrolysis will be the first of the two making an appearance in Fennec. Benjamin Smedberg’s kickoff post for Electrolysis summarizes the project goals:

  • Increased stability: if a plugin or webpage tries to use all the processor, memory, or even crashes, a process can isolate that bad behavior from the rest of the browser.
  • Performance: By splitting work up among multiple processes, the browser can make use of multiple processor cores available on modern desktop computers and the next generation of mobile processors. The user interface can also be more responsive because it doesn’t need to block on long-running web page activities.
  • Security: If the operating system can run a process with lower privileges, the browser can isolate web pages from the rest of the computer, making it harder for attackers to infect a computer.

In fact, Electrolysis has already been used in Firefox 3.6.4 to protect against plugin crashes. Fennec will extend this beyond plugins to the entire web content. All web content will execute in a separate process from the main application. This does create some interesting code changes for both the application and add-ons.

We started a transition document and I’ll cover more details on those changes soon. Look for multi-process web content to appear in Fennec 2.0 Alpha 1 – coming soon.

Work to integrate Layers into Fennec will start shortly after the release of Alpha 1. In addition to the potential of hardware accelerated rendering on mobile devices, Layers also allows Fennec to remove the custom built canvas-tile-cache rendering solution used to achieve decent panning performance and responsiveness. Layers supports a “retained mode” rendering system, which means the application can drop the canvas-tile-cache system and use traditional XUL elements for the browsing surface.

There is a lot of work to do, but progress is happening at a surprisingly fast pace. Fennec 1.1 adds a lot of solid UX features and although we’ll continue to improve the UX for Fennec 2.0, the primary reasons for many of the platform changes are: Speed, Responsiveness and Stability!

Firefox for Maemo 1.1 RC 1

Firefox for Maemo 1.1 RC 1 is ready to install. For this release, the focus was some UI features we didn’t have time to put in the initial release. We also used your feedback from previous releases and nightly builds to help improve the browsing experience.

Some of the bigger features include:

As always, we’ve provided unbranded Fennec desktop builds on Windows, Mac, and Linux. You can use these if you don’t have a Maemo device or to aid in add-on development. This is the final call for Add-on developers to update their add-ons from Firefox 1.0.x for Maemo.

Note to Ovi Store Customers: If you installed Firefox 1.0.x from the Ovi Store, you will not be able to upgrade to Firefox 1.1 RC 1 (either from the N900 Application Manager or by downloading the software from Mozilla). We are working to solve this for future releases so that anyone can participate in our Beta programs. Don’t worry, though, if you got Firefox 1.0.x from either the Ovi store or directly from Mozilla, you will be updated to Firefox 1.1 (final) when it is released.

Updating Add-ons in Firefox Mobile 1.1

In previous versions of Firefox Mobile, you could check for and install updates for your add-ons by pressing the “Update” button in the Add-ons Manager. This meant that you could check whenever and as often as you wanted, but, if you didn’t really want to manage these things manually, you could find yourself without the latest versions.

Desktop versions of Firefox will prompt you that a new version of an add-on is available. Maybe this prompt is enough for you to actually update the add-on, maybe it isn’t. Maybe you find the whole process annoying and/or boring.

In Firefox Mobile 1.1, we introduce automatic add-on upgrades. Once a day, Firefox will check your add-ons for an update and if an update is found, we download and install the new version. If you’re interested, you can go to the Add-ons Manager and see what add-ons have been updated. If you’re eager to use the new add-on, you can restart. In the future, some add-ons may not even need a restart.

Of course, you can still use the “Update” button to force add-ons to update right away, without waiting for the next automatic check.

If you want to turn off automatic add-on updates, you can use about:config and set extensions.autoupdate.enabled to false. If you’d like to change the timing for automatic updates, set extensions.autoupdate.interval to a different number of seconds.