Firefox and GTK+ 3

Lately at Collabora I have been working on helping Mozilla with the GTK+ 3 port of Firefox.

The problem

The issue we had to solve is that GTK+ 2 and GTK+ 3 cannot be loaded in the same address space. Moving Firefox from GTK+ 2 to GTK+ 3 isn’t a problem, as only GTK+ 3 gets loaded in its address space, and everything is fine. The problem comes when you load a plugin that links to GTK+ 2, e.g. Flash. Then, GTK+ 2 and GTK+ 3 get both loaded, GTK+ detects that, and aborts to avoid bigger problems. This was tracked as bug #624422.

More specifically, Firefox links to libxul.so, which in turn links to GTK+. These days, the plugins are loaded in a separate process, plugin-container, which communicates with the Firefox process through IPC. If plugin-container didn’t link to GTK+, there would be absolutely no problem, as the browser (Firefox) process could link to GTK+ 3 and plugin-container could load any plugin, including GTK+ 2 ones. However, although plugin-container doesn’t directly use GTK+, it links to libxul.so for IPC, which brings GTK+ into its address space.

The solution

In order to solve this, we evaluated various options. The first one was to split libxul.so in two parts, one with the IPC code and lower level stuff, which wouldn’t link to GTK+, and another side with the rest of the code, including all the widget and toolkit integration, which would obviously link to GTK+. However this turned not to be possible as the libxul code was too intricate.

In the end, we decided to add a thin layer between libxul and GTK+, which we called libmozgtk.so. This small layer links to GTK+ 3, and provides stubs for GTK+ 2 specific symbols. Additionally, there is a libmozgtk2.so with SONAME “libmozgtk.so”, which links to GTK+ 2 and provides stubs for GTK+ 3 symbols. We made libxul link against libmozgtk.so, and so when Firefox runs, libxul.so, libmozgtk.so, and GTK+ 3 are loaded, and Firefox uses GTK+ 3. However when plugin-container is executed, we add LD_PRELOAD=libmozgtk2.so in the environment. Since libmozgtk2.so has a libmozgtk.so SONAME, the libxul.so dependency is satisfied, and the plugin-container process ends with GTK+ 2. Since plugin-container doesn’t make use of the GTK+ code in libxul, this is safe, and we end up with a GTK+ 3 Firefox that can load GTK+ 2 plugins. The end result is that you can watch Youtube videos again!

While this solution is somewhat hacky, it means we didn’t need to mess with libxul, splitting it in two just for the Linux/GTK+ port’s sake. And when the GTK+ 2 plugins become irrelevant, or NPAPI support is removed (as it recently happened in Chrome), we should be able to easily revert this and use GTK+ 3 everywhere.

Wayland

On an unrelated note, we have looked a bit at porting Firefox to Wayland. Wayland is designed to be a replacement for X11, and is becoming very popular in the digital TV and set top box space. Those obviously need HTML engines and web browsers, and with WebKit and Chrome already having Wayland ports, we think Firefox shouldn’t fall behind.

For this, the GTK+ 3 port was a prerequisite, but that isn’t enough. There are many X11 uses on the Firefox codebase, most of which are guarded by #ifdef MOZ_X11, though not all of them are. We got Firefox to start on Weston (the Wayland reference compositor) with a bunch of hacks, one of which broke keyboard input (but avoided a segfault). As you can see from the screenshot, things aren’t perfect, but it’s at least a good start!

Firefox running on Weston

RCBW #1 – Me too!

After fixing some bugs this week, I’ve noticed they’ve been one per day (on average) so I think I’m joining Stefano Zacchiroli on this RCBW thingie… let’s see if I can keep up!

These are this week’s bugs:

#561645 – gdesklets – Doesn’t work with python2.6 (thanks to Andrew Starr-Bochicchio)
#571488 – gedit – FTBFS with Python 2.6 as default
#571517 – totem – FTBFS with Python 2.6 as default
#571510 – rhythmbox – FTBFS with Python 2.6 as default
#533836 – spe – FTBFS with Python 2.6 as default
#569378 – gnet – FTBFS
#551215 – gtkmm-documentation – FTBFS

I’ve also sponsored gnome-dvb-daemon for Sebastian Reichel, which fixes two more RC bugs:

#566949 – gnome-dvb-daemon – FTBFS with Python 2.6 as default
#569480 – gnome-dvb-daemon – FTBFS

It’s interesting to note that all of the above bugs except for the spe one are from pkg-gnome packages. We still have a few more, although they are the hard ones so it’s not gonna be that easy for the next week…

Boycott Novell

My last post about becoming a Debian Developer has, to my surprise, been linked from boycottnovell.com. I wonder why it would be interesting in such a page. My guess is that it’s been included there because I mentioned “Josselin Mouette”, who has been flamed before in that page. Maybe they automatically filter several planets, and this is one of the patterns. If this is true, I think I’ll start writing Josselin Mouette, Mirco Bauer and Jo Shields somewhere in every post I write from now on (maybe hidden in a comment or in the alternate text of an image, if that works) to get my posts linked from there. It would be a funny way to publicize my blog 😀

New Debian developer Emilio Pozuelo Monfort

I’ve been waiting for a mail with a subject like the one in the title for some time already, and it’s finally arrived at my inbox this morning!

This means I’m a DD now, and will soon start to break^Wupload things into the archive.

Big thanks to all the people that have helped and guided me since I came to Debian, including (but not limiting to) Piotr Ożarowski, Loïc Minier, Josselin Mouette and Sebastian Dröge! I also want to thank all the people involved in the NM process, including my application manager Patrick Schoenfeld.

I started in the NM queue on November 1st of last year, so overall it’s taken almost 10 months. Of them, about 1.5 were spent waiting for an AM to be assigned to me, and about 3.5 waiting for the FD and the DAM. There seems to be some room for improvement here. Let’s see what we can do.

By the way I’m not the only one celebrating. Luca has also become a DD, congrats!

PS: I turned 21 this Sunday, so this has been a nice birthday gift!

Working on Liferea

Since this January, I’ve been doing upstream work for Liferea. This is a great oportunity to learn C and to contribute more to an upstream project! And the atmosphere around Liferea is great. Today I’ve published my first post in the Liferea blog. If you are a Liferea user, you may want to subscribe to it!

There is a lot of work going on in Liferea. We are working hard to release 1.6 (which will use WebKit as the rendering backend) without any known regressions. Most of the performance work will likely go into the next series though, but 1.6 shouldn’t be any worse than 1.4.

If you would like to contribute, don’t be shy and join #liferea on Freenode! We have some blockers for 1.6 and some other things to do, and we will appreciate any contributions. Testing is also appreciated. We are mostly interested in the unstable series, so if you find a bug in the latest unstable release or in trunk, file a bug report!

Collaborative maintenance

The Debian Python Modules Team is discussing which DVCS to switch to from SVN. Ondrej Certik asked how to generate a list of commiters to the team’s repository, so I looked at it and got this:


emilio@saturno:~/deb/python-modules$ svn log | egrep "^r[0-9]+ " | cut -f2 -d'|' | sed 's/-guest//' | sort | uniq -c | sort -n -r
865 piotr
609 morph
598 kov
532 bzed
388 pox
302 arnau
253 certik
216 shlomme
212 malex
175 hertzog
140 nslater
130 kobold
123 nijel
121 kitterma
106 bernat
99 kibi
87 varun
83 stratus
81 nobse
81 netzwurm
78 azatoth
76 mca
73 dottedmag
70 jluebbe
68 zack
68 cgalisteo
61 speijnik
61 odd_bloke
60 rganesan
55 kumanna
52 werner
50 haas
48 mejo
45 ucko
43 pabs
42 stew
42 luciano
41 mithrandi
40 wardi
36 gudjon
35 jandd
34 smcv
34 brettp
32 jenner
31 davidvilla
31 aurel32
30 rousseau
30 mtaylor
28 thomasbl
26 lool
25 gaspa
25 ffm
24 adn
22 jmalonzo
21 santiago
21 appaji
18 goedson
17 toadstool
17 sto
17 awen
16 mlizaur
16 akumar
15 nacho
14 smr
14 hanska
13 tviehmann
13 norsetto
13 mbaldessari
12 stone
12 sharky
11 rainct
11 fabrizio
10 lash
9 rodrigogc
9 pcc
9 miriam
9 madduck
9 ftlerror
8 pere
8 crschmidt
7 ncommander
7 myon
7 abuss
6 jwilk
6 bdrung
6 atehwa
5 kcoyner
5 catlee
5 andyp
4 vt
4 ross
4 osrevolution
4 lamby
4 baby
3 sez
3 joss
3 geole
2 rustybear
2 edmonds
2 astraw
2 ana
1 twerner
1 tincho
1 pochu
1 danderson

As it’s likely that the Python Applications Packaging Team will switch too to the same DVCS at the same time, here are the numbers for its repo:

emilio@saturno:~/deb/python-apps$ svn log | egrep "^r[0-9]+ " | cut -f2 -d'|' | sed 's/-guest//' | sort | uniq -c | sort -n -r
401 nijel
288 piotr
235 gothicx
159 pochu
76 nslater
69 kumanna
68 rainct
66 gilir
63 certik
52 vdanjean
52 bzed
46 dottedmag
41 stani
39 varun
37 kitterma
36 morph
35 odd_bloke
29 pcc
29 gudjon
28 appaji
25 thomasbl
24 arnau
20 sc
20 andyp
18 jalet
15 gerardo
14 eike
14 ana
13 dfiloni
11 tklauser
10 ryanakca
10 nxvl
10 akumar
8 sez
8 baby
6 catlee
4 osrevolution
4 cody-somerville
2 mithrandi
2 cjsmo
1 nenolod
1 ffm

Here I’m the 4th most committer 😀

And while I was on it, I thought I could do the same for the GNOME and GStreamer teams:


emilio@saturno:~/deb/pkg-gnome$ svn log | egrep "^r[0-9]+ " | cut -f2 -d'|' | sed 's/-guest//' | sort | uniq -c | sort -n -r
5357 lool
2701 joss
1633 slomo
1164 kov
825 seb128
622 jordi
621 jdassen
574 manphiz
335 sjoerd
298 mlang
296 netsnipe
291 grm
255 ross
236 ari
203 pochu
198 ondrej
190 he
180 kilian
176 alanbach
170 ftlerror
148 nobse
112 marco
87 jak
84 samm
78 rfrancoise
75 oysteigi
73 jsogo
65 svena
65 otavio
55 duck
54 jcurbo
53 zorglub
53 rtp
49 wasabi
49 giskard
42 tagoh
42 kartikm
40 gpastore
34 brad
32 robtaylor
31 xaiki
30 stratus
30 daf
26 johannes
24 sander-m
21 kk
19 bubulle
16 arnau
15 dodji
12 mbanck
11 ruoso
11 fpeters
11 dedu
11 christine
10 cpm
7 ember
7 drew
7 debotux
6 tico
6 emil
6 bradsmith
5 robster
5 carlosliu
4 rotty
4 diegoe
3 biebl
2 thibaut
2 ejad
1 naoliv
1 huats
1 gilir


emilio@saturno:~/deb/pkg-gstreamer$ svn log | egrep "^r[0-9]+ " | cut -f2 -d'|' | sed 's/-guest//' | sort | uniq -c | sort -n -r
891 lool
840 slomo
99 pnormand
69 sjoerd
27 seb128
21 manphiz
8 he
7 aquette
4 elmarco
1 fabian

Conclusions:
– Why do I have the full python-modules and pkg-gstreamer trees, if I have just one commit to DPMT, and don’t even have commit access to the GStreamer team?
– If you don’t want to seem like you have done less commits than you have actually done, don’t change your alioth name when you become a DD 😉 (hint: pox-guest and piotr in python-modules are the same person)
– If the switch to a new VCS was based on a vote where you have one vote per commit, the top 3 commiters in pkg-gnome could win the vote if they chosed the same! For python-apps it’s the 4 top commiters, and the 7 ones for python-modules. pkg-gstreamer is a bit special 🙂

Hello Planet Debian!

Hello Debian fans! I’m Emilio Pozuelo Monfort (aka pochu), a Debian contributor coming from Ubuntu (where I’m a MOTU), and hopefully a DD in the near future, as I’m in NM. Sandro Tosi has added me to Planet Debian, so here I am! I’ll be posting from time to time (don’t expect me to flood your feed reader, I’m more of a casual writter) with Debian-related topics.

For those of you who don’t know me, I’m an Spanish guy contributing mostly to the GNOME packages and some Python applications. But if something breaks in your desktop, don’t blame me, but my sponsor! 😛

Freenode

Today’s my birthday on Freenode 🙂

01:06 [notice(NickServ!NickServ@services.)] Information on pochu (account pochu):
01:06 [notice(NickServ!NickServ@services.)] Registered : Dec 13 21:40:22 2006 (2 years, 0 weeks, 0 days, 02:26:05 ago)
01:06 [notice(NickServ!NickServ@services.)] Last addr : n=emilio@ubuntu/member/pochu
01:06 [notice(NickServ!NickServ@services.)] vHost : ubuntu/member/pochu
01:06 [notice(NickServ!NickServ@services.)] Last seen : now
01:06 [notice(NickServ!NickServ@services.)] Logins from: pochu
01:06 [notice(NickServ!NickServ@services.)] Nicks : pochu pochu_
01:06 [notice(NickServ!NickServ@services.)] Email : asdf@asdf.com (hidden)
01:06 [notice(NickServ!NickServ@services.)] Flags : HideMail
01:06 [notice(NickServ!NickServ@services.)] *** End of Info ***

New Maintainer

About one year and a half after my first package was uploaded to Debian, I decided to apply to become a Debian Developer last month. It didn’t happen inmediately because in order to apply you are asked whether you have read the foundation documents, the policy, the developers reference… and I didn’t want to cheat! 😀 So I took the time to read all of them, and then applied on November 1st!

Loïc Minier advocated me (thanks!) and now I’m waiting to be asigned an AM. I hope not to loose interest in the meantime 😉