From MozillaWiki
Jump to: navigation, search

Native Webapps Support on Linux

The Native Webapps feature in Firefox permits a webapp to be installed in the OS and launched as a separate process in a standalone window and environment. Currently this support exists for Windows and OSX, and the goal of this project is to bring the same support for Linux desktop, specifically for Gnome. The work consists in two pieces: support for the standalone runtime that runs the webapps, and support for the installation process that installs them to the OS.

Activities during the "Community Bonding" period

  • Study the code of the implementations for Windows and Mac.
  • Watch webapps related bugs and their fixes (see bug 731054).
  • Improve my knowledge of the Mozilla codebase.
  • Study the Mochitest testing framework, that could be useful to write automated tests (see bug 733631).
  • Decide the approach for webapps installation/removal (


Time To Do
May 21 - May 28 Implement the webapp launcher (I).
May 28 - June 4 Implement the webapp launcher (II).
June 4 - June 11 Test the implementation with manual test cases. Correct eventual bugs.
June 11 - June 18 Implement installation in the home directory.
June 18 - June 25 Support the creation of .desktop files in the standard directories and the reloading of menus, when necessary (for example on GNOME it's automatic, on KDE you have to execute an external binary)
June 25 - July 2 Implement support to uninstall applications.
July 2 - July 9 Manual testing on several distributions (with different desktop managers, Unity,GNOME,KDE,Xfce,LXDE) and possibly write automated tests. Correct eventual bugs.
July 9 - July 16 Test the implementation with manual test cases. Correct eventual bugs. During this week we'll also submit the mid-term evaluations.
July 16 - July 23 Implement automatic update of the webapp launcher. We could use GSettings to store the Firefox installation path, as another way to check a new webapprt version (other than "installDir" in the webapp.ini).
July 23 - July 30 Manual testing on several distributions (with different desktop managers, Unity,GNOME,KDE,Xfce,LXDE) and possibly write automated tests. Correct eventual bugs.
July 30 - August 6 Any other business.
August 6 - August 13 Any other business.
August 13 - August 20 Improve documentation.

Obviously the work could be subject to delay depending on the approach we'll adopt for uninstallation. This is why I decided to have two weeks without any specific work planned.

Weekly status reports

I'll write here weekly reports about my work, starting from May 21. (The date format is DAY/MONTH).

21/05 - 28/05

In the first weeks of my GSoC I learnt a lot of things about Open Web Apps and the implementation of native installation/uninstallation and execution of web apps on Windows and Mac. I've seen how other Mozilla developers solved many of the problems that occured with webapps and even helped to solve a (really) small issue with the Mac installer.

I've already started to develop the webapprt launcher and the installer and, if you want, you can try the implementation with a try build (but consider that it's not ready for production, the installation directories will likely change and the uninstallation isn't yet implemented). On Gnome 3 and Unity you'll find your installed web apps respectively in the application picker and in the dash. On the other desktop environments in the applications menu (but as for now the applications aren't categorized, they won't be showed).

At the beginning I wrote the webapprt launcher using GLib and GIO, but later I decided to directly use Linux functions.

The plan for uninstallation is to add a desktop action to the app icon. But sadly Gnome doesn't support this as yet: So there will probably be a special Firefox page (about:apps) to manage apps on platforms that don't support desktop actions.

The webapps will most probably be installed to the home directory, under ~/.config/<webappuniqueid>.

About the Linux implementation coming after the Mac and Win ones, it isn't a Mozilla fault. The problem is that Linux distributions lack a common way to install/uninstall applications, desktop environments have different behaviours (even when it comes to freedesktop standards). The extreme opportunities of Linux personalization have their shortcomings!

During these weeks I've also started to contribute to GFX, working on the porting of OMTC to basic layers (in simpler words this means software omtc, that in my opinion is really important to improve Firefox responsiveness on older machines, where layers hardware acceleration is disabled).

I'd like to thank Felipe, my mentor, along with the other Mozilla developers for their help and support. And I'd like to thank the Mozilla community (especially Linux users) for their help and feedback (many of them have been eager to test the first implementation and they gave me a lot of useful feedback).

Feel free to give your feedback and stay tuned for other weekly reports!

28/05 - 04/06

This week has been really interesting. With the help of some fast and effective reviewers, I've been able to land the installer and the launcher implementation in Firefox 15. You can now test my work on Aurora (when it'll be released in the coming days), so I'm going to delete the old try builds.

We've already found two problems and fixed one.

1) It was impossible to launch multiple applications. This showed up (in the past) on Windows too and needed a really simple fix that will most probably be uplifted to Aurora (bug 761496).

2) There is a build problem with other *nix platforms. Luckily this showed that the implementation could work on other *nix platforms too (like bsd), even if my work was supposed to work only on Linux. So we have to be grateful that this build error showed up, otherwise we wouldn't have tested on bsd. As I said the first week, feel free to test the work and file bugs (it would be better if you talk in #openwebapps before filing bugs), but remember that the implementation isn't ready through-and-through (for example there isn't the uninstallation support: bug 761806).

As yet, your web applications will be installed in your home directory, with this format: ~/.SCHEME;HOST[;PORT] A desktop entry file will be stored in $XDG_DATA_HOME/applications (usually it's ~/.local/share/applications), with the same format. So you should see the application icon in your applications menu (if you're on GNOME 2 and the other "classic" desktop environments), in your applications picker (if you're on GNOME 3), in your dash (if you're on Ubuntu).

So far, the webapp support has been tested on GNOME 2, GNOME 3, Unity, LXDE. In LXDE there is a problem related to the categorization (if the desktop entry file hasn't a category, the application icon won't be showed in the menu). We'll however support the categorization (bug 760748). I haven't tested yet on XFCE, Cinnamon and KDE. But I hope these three support freedesktop standards!

04/06 - 11/06

During this week I focused my efforts on resolving some bugs. We've fixed an assertion related to GTK, a wrong check in the Windows and Mac runtimes and a bug that was preventing the launch of multiple different applications. This last bug affected also Windows and was already solved for this platform, so this showed us that we should refactor a bit the code to avoid code duplication (so that the fixes will apply to all the platforms).

Thanks to a freebsd developer, we've tested the implementation on bsd. His patch also solved another bug (that was related to the "/proc/self/exe" symlink that could be altered:

I've also added some manual test cases to MozTrap, that is a test case management system developed (and used) by Mozilla.

Thanks to the Linux Mozilla community, we now know that Web Apps are working on Cinnamon and KDE too (but we'll need the categorization to improve the integration of web apps in the menus).

11/06 - 18/06

This week was pretty calm. We added a notification in the Marketplace after the installation of an application on Linux. I've registered an account on GitHub to do this. If you have any idea on how to improve the message, feel free to comment on the pull request (

I've started the work about moving the installation directory under $XDG_CONFIG_HOME and to support uninstallation through a desktop action. Moving the installation to $XDG_CONFIG_HOME isn't so simple as I initially thought, because of the way Firefox handles profile directories: Instead, supporting the uninstallation through a desktop action is pretty simple. I've developed a patch that is waiting for a review:

We've also found out two bugs related to re-installation of a running application (bug 763375 and bug 751898), that I think could be solved by disabling the re-installation of a running application by locking its profile (

And we've found out that the installer was removing the profile directory for each re-installation (only on Windows and Linux), so if you tried to re-install an application, you would lose all its data (also the authorizations, like the geolocation one). I've started to work on a patch to solve this problem:

18/06 - 02/07

Sorry, I forgot to write a report for the last week. I'll now write a report for the last two weeks :)

I attended an Italian conference about free software with other Mozillians (you can read the report here:

I worked on some cross-platform problems about webapps reinstallation. This isn't a common use case, but it's however good to fix.

I've continued to work on webapps uninstallation through a specific desktop action (desktop actions are for now supported only by Unity, there's a bug in the GNOME bugzilla but no one is working on it and sadly, in my opinion, they will not support them in time for GNOME 3.6). I've also learned how Mozilla handles localization. So we need to support uninstallation through about:apps, I'll find out if there's someone actively working on that page, otherwise I'll continue Fabrice's work:

I hope about:apps could be finished in time for Firefox 16, otherwise a lot of Linux users won't be able to remove applications in a simple way.

During the last week, I've also studied for an exam: "Theory of Signals" (that I did on the 3rd of July).

02/07 - 06/08

I've worked to enable mochitests for the webapp runtime on Linux and Windows (with this work I've also seen how the mochitest works internally). It wasn't hard as the Mac OS X part was already implemented.

I've finished the work to support webapps uninstallation. I've split the work in several parts to ease the backport to Aurora (I'd like to backport the feature, that has landed in Firefox 17, to Firefox 16). Now there's support to uninstall the application by using a command-line argument (“-remove”) or through a specific page (about:apps or a web dashboard, like Actually there's a function in the mozApps API ( that removes the application (on Linux it removes the application from your computer, on the other platforms it currently removes the application only from your profile), and the dashboards use this function.

I've also finished the work to support categorization of web applications. Now the install function of the mozApps API ( accepts a JSON object, and in this JSON object you can pass the category (or the categories) of the application. We support the categories of the Mozilla Marketplace, you can see this patch ( to see how we translate the Marketplace categories to standard categories (I hope the translation was better, I'd like to have some user feedback about it). The category isn't stored in the Application object (that you can retrieve using the getSelf mozApps API function), but you will be able to get it through install_data (that will be in the Application object in the future:

I'm now working to move the installation to $XDG_CONFIG_HOME, but this isn't a high priority work. I've encountered many problems, but I've finally figured out what's their cause. I can change the profile directory through the “-profile” command-line argument (or through an environment variable, XRE_PROFILE_PATH), but even after that the “AppRegD” directory (that is the Application Registry Directory) and other “special” directories still use the normal directory format (/home/user/.appname/). The “AppRegD” directory is used by the Crash Reporter.

During these weeks I've studied for other exams and I've been on vacation in Ponza (an Italian isle) and in Scotland.

06/08 - 13/08

I've managed to write a patch to support installation in $XDG_CONFIG_HOME, it involved some code changes in how Firefox finds the user data home directory.

I've added a notification for add-ons (through after the installation of a webapp. This way, add-ons could do something after installation, for example they could create a deb or rpm package and install it, or something else to better integrate the webapp with the underlying platform.

I've also started to work on the user notification (a graphic notification, not a low-level notification for addons) after a webapp removal. There are some opportunities (a GTK alert, nsIAlertsService, dbus, dlopen libnotify), the best way would be to use the nsIAlertsService, but it's also pretty hard. Maybe I'll start with a simpler solution to have something in place for Firefox 17 (the notification involves the creation of new localizable strings, the patches with those strings are less likely to be backported).

I've also ported a SDL C++ game (Ceferino) to JavaScript, using Emscripten. Here it is: Using Emscripten is really simple, it took me only a day to port the game. I'm going to upload it to the Mozilla Marketplace.