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.

The Future of JavaXPCOM

This is a public service announcement for those people interested in the future of JavaXPCOM. JavaXPCOM has been disabled and will likely to removed from the Mozilla source tree in the future. See Benjamin Smedberg’s newsgroup post for more details.

Please follow up (add comments) to the newsgroup post.

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.

Crash Reporting Comes to Firefox Mobile

The latest Firefox Mobile nightly builds have enabled the Mozilla Crash Reporter, powered by the same Breakpad system as desktop Firefox. While desktop Firefox has been using Breakpad since Firefox 3.0, it was only recently ported to the ARM architecture of the Nokia N900.

Now, when Firefox Mobile (or Fennec nightlies) crash, you should see this application appear:

If you decide to send a crash report to Mozilla, and we really hope you do, you can see your crash, and other crashes, at the Mozilla Crash Reports web site. Here’s a list of all the Firefox Mobile crashes. For example:

You can also manage crash reports from Firefox Mobile itself. Use about:crashes to view all the crash reports created on your device:

Crash reporting and the data they provide will be a huge help to the mobile team. A big thank you goes out to everyone who helped get crash reporting enabled on Maemo!

Smart Tapping in Mobile Firefox

It’s now well understood that, when designing for a touchscreen, there are certain minimum usable sizes for touchable targets. While the amount you can display on a screen is increasing with higher resolutions, human finger sizes aren’t changing, and fingertips are much larger than a mouse pointer. As a result, most UI recommendations for touch-target sizes on mobile devices range from around 7mm to 9mm.

It’s relatively easy to take these minimum sizes into account when designing your own interface. But what about when you’re displaying something that someone else has designed, and that wasn’t built with fingers in mind? This is the situation mobile browsers encounter in most web pages: links, fields, and buttons are often much smaller than you’d want them to be in order to tap on them, but making them bigger would interfere with the designer’s intended layout.

An approach that a number of touch-oriented OSes take is to make a small target’s tap-sensitive area larger, invisibly, than the visible target itself. This approach has been cleverly referred to as using “iceberg buttons” because the visible part of the target is much smaller than what’s lurking below. In fact, the iPhone does this with their keyboard as well, dynamically changing the invisible button target size based on what letters it predicts are most likely to come next.

Given how central link-tapping is to a browser, and how frustrating it is to tap the wrong link or not be able to tap at all, we decided to build our own approach.

Introducing SmartTap

In Firefox Mobile 1.1, we’ve added a smart-tapping scheme with the goal of allowing for accurate and easy tapping on links, form widgets and other focusable targets in web content. The main concepts of the approach are:

  • Using a region, not just a point, to define the tap location
  • Creating a list of focusable element candidates in the region of the tap
  • Weight the elements by z-order
  • Weight the elements by distance from the actual touch point
  • Weight the links by number of visits

The result of the algorithm should be the element you were most likely trying to tap. Initial results show that tapping elements in Firefox Mobile 1.1 is much easy than previous versions. From a user’s perspective, taps just seem to work as they should.

Implementation Details

The code to support SmartTap was added to both the Mozilla platform and the Firefox front-end. It’s very flexible. The platform already exposes an elementFromPoint API to chrome and web content. The new API, nsIDOMWindowUtils.nodesFromRect, is very similar, but is only available to chrome content. For a given region, established by top/right/bottom/left, and a point, the method will return a list of possible DOM nodes.

The returned list is sorted in z-order. The Firefox front-end code then applies additional heuristics to the node list to find the most likely candidate. The code filters the nodes by “focusable” elements, weights by the distance of each node from touch point and, finally, weights visited links higher than other elements.

The region passed to nodesFromRect can be controlled via preferences (browser.ui.touch.top, browser.ui.touch.right, browser.ui.touch.bottom, browser.ui.touch.left). The weighting used for the visited links can also be adjusted using the browser.ui.touch.weight.visited preference.

Firefox Mobile uses a region that is offset more above the touch point. This has the affect of favoring elements above the touch point – which is based on our observations that people tend to “tap” below elements. Here’s a simple illustration:


click for larger image

The red dot is the actual touch point. The red box is the region passed to nodesFromRect. The title link will end up being “clicked” even though the author’s name text was actually “tapped.”

Another bit of intelligence in this system is based on the same insight that drives the Firefox awesomebar: that people tend to visit the same pages over and over again. Links are given higher weightings if they’ve been visited before, so visited links are more likely to “win” if a tap target is ambiguous because multiple small links are very close together. In practice, from the user’s perspective, tapping on the intended link just seems to work more often.

Thanks to Madhava Enros, Vivien Nicolas and Felipe Gomes for contributing to this post.