Home > Writing Themes > Writing Themes Part Five: Themes and the Firefox World

Writing Themes Part Five: Themes and the Firefox World

This section talks about where themes fit into the larger context of the Firefox software ecosystem and the Mozilla community as a whole.

Mozilla Software Other Than Firefox

Unless you're in the software business, you may not be more than peripherally aware of all the current browser offerings or all the variations of Mozilla software available right now. It turns out that there are dozens. For those who want a more complete picture, here's an overview with links to more information.

The current major applications projects from Mozilla:

  • Mozilla Firefox: a standalone web browser that is the flagship of the Mozilla software family
  • Mozilla Thunderbird: a standalone program for reading email and news
  • Mozilla Sunbird: Sunbird is Mozilla's standalone calendar application.
  • Lightning: Lightning is a calendar extension for Mozilla Thunderbird. It offers calendaring features directly in the Thunderbird user interface. Lightning is a product of the same group that is developing Sunbird.
  • Mozilla Application Suite: Mozilla Application Suite is the discontinued bundle that contained a web browser, email software, and a web page composer. Mozilla Suite was discontinued by the Mozilla Corporation in order to focus more exclusively on Firefox and Thunderbird. The concept of a bundle of integrated applications lives on in the Seamonkey project.
  • Seamonkey: Seamonkey is the current incarnation of the Mozilla Application Suite, and includes a web browser, email software, and a web page composer. At one point in time the Mozilla Application Suite on which Seamonkey is based was discontinued by the Mozilla Corporation, but members of the Mozilla community at large restarted development in the form of Seamonkey. The status of Seamonkey is "not quite official". It still receives support in various forms from the Mozilla Corporation.

    magneto>    hi, does Seamonkey receive support from the Mozilla foundation the same way that 
                Firefox does, or is it more separate? i'm just trying to get the big picture view 
                of where seamonkey fits in
    Lucy_>      magneto: it's much more separate, and firefox is a product of the corporation that's 
                owned by the foundation
    cf>         There is some infrastructure support
    magneto>    Lucy: thanks for that
    Lucy_>      yeah it's slightly complicated now the guys in #seamonkey could probably explain what 
                support they get from the foundation better
    magneto>    good idea, but i'm not really intersted in finances or legality, more just about how 
                "unofficial" it is, which you answered quite nicely
    Lucy_>      right, even so, I mean I know it's totally unofficial, but i don't know what that 
                means in terms of what sort of time/involvement they get from the foundation, 
                I mean seamonkey is still linked on mozilla.org etc

Additional Projects:

  • Flock: Flock is a browser which is derived from the same source code as used by Firefox. Although not a product of the Mozilla Corporation, Flock shares many features and windows with Firefox. It is a very close relative, with some significant additions to support blogging.
  • Camino: Camino is a browser for Mac OS X based on much of the same source code as Firefox. Camino is available only for Mac OS X, and uses features specific to OS X for smooth integration with the OS X desktop and the Macintosh user experience. You can read about differences between Firefox and Camino here.
  • Bon Echo: Bon Echo is the project code name for a not-yet-released verion of Firefox. When ready, Bon Echo will be released as Firefox 2.0.
  • Minefield: Minefield, like Bon Echo, is the project code name for a prerelease verion of Firefox. Minefield is slated to become (as planned at the time of this writing) Firefox 3.0 when it is released.
  • Safari: Safari is a browser for Mac OS X. It is an official product of the Apple Corporation.
  • Nvu: Nvu is a standalone web authoring system (for creating web pages) that runs on Windows, Mac, and Linux. It is an open source product sponsored by Linspire, Inc.

Here is a list of several other Mozilla projects, and this page lists other browser distributions based on the rendering engine common to all Mozilla software.

Branch and Trunk

You may see reference to the terms "branch" and "trunk". These refer to versions of the Firefox source code (as well as for other Mozilla applications, since the source is shared across applications). The way it works is this. The trunk refers to the main body of source code as it progresses and moves forward through the ages. As changes are made, they are applied to the trunk. Every now and then, the trunk is deemed good enough or stable enough to release to the public as an application, at which point a branch is created, with the branch code being the source for the released application.

At first, for a very brief period of time, branch and trunk are identical, but as time goes on development of trunk goes on too, and not all the changes in trunk are suitable for use in the released application, so the trunk begins to differ from the branch. Further, the team in charge of the released application makes changes to the application-specific code in the branch, so that the trunk further differs from the branch.

Why not just keep branch and trunk the same? Why separate into branch and trunk at all? Mainly because the branch code, which is the source code for the released application, can contain only those changes suitable for the released application. The trunk code tends to be more experimental and exploratory, trying new features, new user interfaces, new technologies and new ways of doing things. Further, the trunk code is more forward-looking, in that it may include or exclude support for different platforms (as with the dropping of Win98 support for Firefox 3.0) from those supported by the branch.

From time to time, the branch developers will choose to include changes from trunk into the branch. This has happened as Bon Echo (to become Firefox 2.0) proceeds through beta, in that this code, which is branch, has included changes from Minefield (to become Firefox 3.0), which is trunk. For example, Bon Echo has included phishing support, RSS feed support and several related changes to the Options window, all of which were first introduced and proven in the Minefield trunk code and later introduced into the Bon Echo branch code.

Also, branches can have their own branches, as is the case with Firefox 1.5 and Bon Echo. As work began on Bon Echo, that branch continued forward, while the code for Firefox 1.5 was branched off on its own, for the same reasons as already listed above.

At the time of this writing, here is the state of branch and trunk nomenclature:

  • Firefox 1.5: Branch 1.8.0
  • Firefox 2.0 (currently beta) a.k.a. "Bon Echo": Branch 1.8
  • Firefox 3.0 (currently alpha) a.k.a. "Minefield": Trunk 1.8
Nightlies

You may see reference to the term "nightlies". A nightly is a pre-release version of Firefox software that was compiled the night before. For the benefit of the Firefox development team, the entire source for Firefox is recompiled every night. The development team uses this continuous compilation and test process so that developers and testers always have information about the goodness of the latest changes to the application. This helps make sure that any bugs are quickly identified as soon as the offending changes are added to the source code. A nightly version of Firefox is one that was compiled as part of this process.

You may see reference to "the latest nightly" or "the July 7 nightly", the latter referring of course to the version that was compiled on a specific date. It's worth emphasizing that nightly builds are always alpha or beta versions of prerelease software, and not ready for release to the general public.

Nightlies are valuable to the theme developer in that they let you get a look at coming software, so you can anticipate the changes you would need for your theme to work with the coming version. Many theme developers want to make sure that when a new Firefox release is available to the public, their theme is already updated to work with it.

With nightlies, there's a bit of the sense of a being a very small person holding on to the tip of the tail of a very large dog, in that one day you'll see things done one way, and the next a completely different way. Things move quickly in the Firefox world. You may be best off only updating your nightly version every week or so, to cut down on noise and bad inputs to your theme development process.

Nightlies are available for download by anyone, with the warning that they are bleeding edge versions of the software, hot off the griddle, unofficial, prerelease, and very likely to contain errors that may lead to crashes and loss of data including your precious bookmarks.

Nightlies are available by FTP at the following locations.

All nightlieshttp://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/
Latest Bon Echo (Fx2.0) nightlyhttp://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/latest-mozilla1.8/
Latest Minefield (Fx3.0) nightlyhttp://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/latest-trunk/

There's another way to stay up to date with the nightlies (I'm doing this with Bon Echo) which is to use an extension called the "Update Channel Changer", which basically tells Firefox where to look to see if an update is available. In the default state, Firefox looks only for "official" releases, but you can tell it to check instead on the "nightly" channel. This article describes channels and software update. You can get the Update Channel Changer here. If you install the extension, you'll be able to select the update channel by picking "Check for Updates..." under the Firefox "Help" menu.

About LXR

You may run into references to LXR. You don't need to know about this as a theme author, and in fact you can safely ignore it. For the record, it's an online listing of all the source code and images that make up all of the open-source Mozilla software, available through a web interface for anyone to browse. It's called LXR because that's the name of the tool that's used to generate the LXR listing.

This site links to the Mozilla LXR site as a way to display the source code of some XML, XUL, and CSS files that are part of default themes.

LXR is available for each of the major Firefox versions:

  • Firefox 1.5, a.k.a. Branch 1.8.0: LXR
  • Firefox 2.0, a.k.a. Bon Echo, a.k.a. Branch 1.8: LXR
  • Firefox 3.0, a.k.a. Minefield, a.k.a. Trunk 1.8: LXR

magneto>    hi, i'm trying to find some way to display arbitrary Firefox source as web pages (for example browser.xul). 
Ryan>       magneto: Something like http://lxr.mozilla.org/mozilla1.8/source/browser/base/content/browser.xul ?
magneto>    Ryan: something very much like that!
Ryan>       Excellent :)
magneto>    Ryan: LXR gives my the latest checked=in bonecho code?
            would i need to go to CVS for say firefox1.5 code?
Ryan>       It can be delayed up to 24 hours
            For 1.5, just change 'mozilla1.8' to 'mozilla1.8.0' in the link
Callek>     magneto: http://lxr.mozilla.org/mozilla1.8/ is "to be" FF2 code.
            magneto: http://lxr.mozilla.org/mozilla1.8.0/ is FF1.5 stuff
magneto>    ok this is very cool
Callek>     magneto: and http://lxr.mozilla.org/mozilla/ is what will become "FF3" 
            (though it is very early in development)
            magneto: there is (in a way), but I'm not entirely familiar with how to do that, easily.
magneto>    Callek: ok thx
auenf2>     magneto, do a cvs pull of the individual file instead?
magneto>    auenf2: yeah something along those lines, i haven't looked into that, 
            is there a URL that could start getting me oriented?
auenf2>     magneto, the build instructions would help
magneto>    k
auenf2>     and rather than doing: cvs co -rFIREFOX_1_5_0_5_RELEASE mozilla/client.mk 
            you could change the last bit to the file you want
            file and path that is
magneto>    aeunf2: right
            aeunf2: my favortie approach would be a web url that would dynamically bring up 
            the file i'm looking for for display, do you think i'm likely to 
            find something like that in the mozilla cvs system?


magneto>    hi, when i'm looking at LXR, what does "xpfe" stand for?
philor>     cross platform front end, the UI for the old Mozilla Suite and the current SeaMonkey

One thing to keep in mind about LXR is that it displays only the most recent version of any individual file. This means that, if you're looking at the source code for Firefox in LXR, and the latest released version is Firefox 1.5.0.6, then LXR only shows you the source code for 1.5.0.6, and there's no way in LXR to look at the source for previous versions like 1.5.0.5.

If you really need to see the source code for previous versions, you can do that by accessing CVS (a source code repository) and doing what's called a "cvs pull". That topic is beyond the scope of this site. If you need to know more, you can read about it here. Also, Google is your best friend, and you can always run Chatzilla and ask for help through the IRC Channel #firefox on irc://moznet. See this page about Mozilla IRC for more information.

Location of Default Theme in LXR

Where in LXR does the default theme for Fx1.5 reside? Not in any one place. The directory structure of the default theme does not exist in LXR, as such; rather, LXR contains all (most?) of the component files of the theme, in various places, organized according to which module of the application they are used in. The final directory structure of the default theme is constructed when Firefox is built from source, with the various parts of the default theme assembled into their final directory locations in the jar at that time.

Let's do a little detective work and see if we can figure out how to find the default theme in LXR.

First, we'll search for file names containing the word "theme". We already know that the source for Firefox 1.5 can be reached from this page. The "Filename Search" field over on the left will search for files and directories containing whatever search term you enter. You can see the results for yourself. Filtering out every result that's not a directory gives the following list of directories.

/browser/themes/pinstripe/
/browser/themes/winstripe/
/themes/classic/
/themes/modern/
/toolkit/themes/gnomestripe/
/toolkit/themes/pinstripe/
/toolkit/themes/qute/
/toolkit/themes/winstripe/

This file seems to define how source files are mapped to locations in the jar for the default theme for Fx 1.5, for all contents of the package 'global'. Note the variations based on OS. But that results in a non-existent link to global.css, so maybe this is the correct file. Comparing the contents of a few more files in each of the two locations with what is actually in classic.jar, we verify that the root directory for contents of the package 'global', in LXR, is this.

As far as the browser files ... a search in LXR on browser.css yields this:

/browser/base/content/browser.css
/browser/themes/pinstripe/browser/browser.css
/browser/themes/winstripe/browser/browser.css
/themes/classic/global/mac/browser.css
/themes/classic/global/win/browser.css
/themes/modern/global/browser.css
/toolkit/themes/pinstripe/global/browser.css
/toolkit/themes/qute/global/browser.css
/toolkit/themes/winstripe/global/browser.css
Discarding obvious mismatches (Pinstripe is for Mac, "modern" is the name of the old theme from Netscape Communicator, "qute" is the name of a theme which is not the default), we have this list of potentials:
/browser/themes/winstripe/browser/browser.css
/themes/classic/global/mac/browser.css
/themes/classic/global/win/browser.css
/toolkit/themes/winstripe/global/browser.css
From our digging around for the source of the global directory, we know that the mac/ and win/ directories appear not to be used in the default theme for Fx1.5, which means that this
/toolkit/themes/winstripe/global/browser.css
is probably the source for global/browser.css, and that this
/browser/themes/winstripe/browser/browser.css
is probably the source for browser/browser.css.

Maybe the theme is built by taking some surviving elements from the modern theme (CSS?) and overlaying on them added and replacement items from classic?

Looking now for the source for the jar's communicator/ directory, we search for "communicator.css", and get the following results:

  • http://lxr.mozilla.org/mozilla1.8.0/source/browser/extensions/package-fixup/communicator.css seems seamonkey-related
  • http://lxr.mozilla.org/mozilla1.8.0/source/themes/classic/communicator/communicator.css this is clearly the wrong one, it has far too many lines of code
  • http://lxr.mozilla.org/mozilla1.8.0/source/toolkit/themes/winstripe/communicator/communicator.css this seems to be the right one, by elimination
In summary, it looks like, for each of the major directories in classic.jar, we have the following source locations in LXR.
browser/        http://lxr.mozilla.org/mozilla1.8.0/source/browser/themes/winstripe/browser
communicator/   http://lxr.mozilla.org/mozilla1.8.0/source/toolkit/themes/winstripe/communicator
global/         http://lxr.mozilla.org/mozilla1.8.0/source/toolkit/themes/winstripe/global
help/           http://lxr.mozilla.org/mozilla1.8.0/source/toolkit/themes/winstripe/help
mozapps/        http://lxr.mozilla.org/mozilla1.8.0/source/toolkit/themes/winstripe/mozapps

LXR and MXR

LXR is evolving into something called MXR. MXR is essentially the same thing as LXR, with enhancements, on a different server and having a different web address. The source code contained within it is the same as in LXR. You can read more about this in the "LXR Overhaul?" thread on the newsgroup mozilla.dev.planning, and read a background summary here.

Bugzilla

Bugzilla is the name of Firefox's online bug tracking system, which anyone can use to look at or create new bug reports. The Bugzilla home page is here, and you can look at an individual bug report here.

Bugzilla was written by developers for developers, and it does a great job for them. For the rest of us, the Bugzilla user interface is admittedly hard to use, but if you bear down and pay attention it begins to make sense fairly quickly.

Bugzilla is of interest to theme developers in at least a couple ways:

  1. If you see an actual bug or the need for an improvement, you can enter a new bug or feature request.
  2. Firefox developers use Bugzilla as a forum for discussing the pros and cons of various approaches in creating the next version of Firefox. These discussions take place in the comments attached to individual bug reports. If you're keeping track of the nightlies so you can anticipate changes that impact your theme, you may want to keep up with these discussions as well.
  3. Theme developers may be aware of requirements needed to support themes that the core team may not be thinking of at the moment. You can improve the quality of the Firefox product by participating in these discussions and making sure that the theme developer's perspective is represented. For example, when new features are added to the Firefox UI, the underlying DOM tree is frequently lacking in sufficient element IDs to make all parts of the new UI selectable by CSS. As a theme developer, you're likely to notice this before the core Firefox developers, and it helps everyone when you point this out in a new bug report, like this one.

Theme Icon Licensing

Does the theme license apply to any icons/images packaged with the theme? This is an open question for which no definitive answer has been found. (There is an answer, I just haven't found it yet, and anyway I am not a lawyer. If only we knew a J.D.- and Ph.D.-trained theme developer to comment on this ...)

Still, the following discussion makes it seem like, yes, themes which contain GPL'd code (such as CSS derived from the Firefox default theme) must themselves be distributed under the GPL, including everything distributed with them, such as icons and images.

chozang>    do you need to include a license with an extension?
Mook>       it would be nice
Mook>       because otherwise it gets confusing as to if people can steal code from you :p
ThomasVeil  is interested in licensing...
chozang>    ok. an extension doesn't automatically inherit gpl because it comes in contact with firefox?
Mook>       nope
Mook>       for one, firefox by default is MPL (source), and some weird EULA for binaries :)
fatalis>    duh, how could it
ThomasVeil> where can I read about this kind of stuff?
fatalis>    wikipedia
Mook>       m.d.legal? or whatever the newsgruop is named
chozang>    fatalis, do you know much about gpl? from what i understand if your code even calls gpl code, your code becomes gpl! is that correct?
fatalis>    a newsgroup as a point of reference? bah
fatalis>    chozang, no, that's not how gpl works
fatalis>    the viral nature of it it affects only distribution
chozang>    hmm
fatalis>    if you're not going to distribute your extension together with some gpl (not lgpl) code, it can come with any kind of proprietary licence
fatalis>    and with lgpl the rules are even more relaxed
chozang>    k
chozang>    i guess i asked in the right place.
Mook>       actually, I thought if you called GPL code you need to GPL your code too?
Mook>       (whereas LGPL allows you to do that)
Mook>       and MPL is even laxer (it works on per-source-file instead of per-app), and MIT is pretty much free-for-all
fatalis>    that's untrue
Mook>       but then, IANAL so :p
Mook>       fatalis: ooh, please correct me then?
fatalis>    okay, look
fatalis>    the basics
Mook>       (oh yeah, Mozilla is mostly GPL/LGPL/MPL so you can easily take the MPL route for extensions)
fatalis>    copyright is given to you automatically worldwide by the berne convention
Mook>       right
fatalis>    it means the government protects your rights to choose how your IP is used
Mook>       and post-198something you no longer to say "All rights reserved" or something :)
Mook>       *need
fatalis>    by default nobody can use your work for anything without permission
fatalis>    uh
fatalis>    and a licence is like a permission to do certain things with your IP
Mook>       right
Mook>       and you can't do anything with other people's code w/o their agreement, too, by default :)
fatalis>    and the GPL is a licence that tells you how you can distribute software
fatalis>    but you can use it however you wish, it's not an MS eula
Mook>       right
fatalis>    the whole point of GPL is so that companies can't do EEE
Mook>       (you can use it however you wish, as long as you obey the license - which pretty much says if you redistribute, you need to let people have access to the source?)
fatalis>    which stands for Embrace, extend and extinguish
fatalis>    yes, exactly
magneto>    what's the ruling on media packaged with GPL code (such as icons in an extension)?
fatalis>    except, the source needs to be open *and* licenced with gpl
fatalis>    licenced under gpl means that you can't distribute it with a proprietary licenced product
fatalis>    ^ about the icons
fatalis>    and lgpl is for libraries
magneto>    how about if i quote a section of GPL code on a web page ... am i then GPLing the contents of that page?
fatalis>    lgpl javascript code can be used in commercial websites, for instance :-)
Mook>       where LGPL says it's okay to link against the little stub that calls the actual library, right?
Mook>       (whereas you can't do that with GPL, since you're still using their code)
ThomasVeil> Q. How much should someone using addons.mozilla.org know about licensing? (How long is a stick?)
fatalis>    Mook, it's still only about distribution of copies, linking and interfacing is fine anyway
Mook>       fatalis: well, yeah, I mean distributing things which link to the stub :p
fatalis>    magneto, no, the snippet you post stays gpl, and the rest of the page is (c) its owner
Mook>       whatever the heck you do on your own, nobody cares about :p
fatalis>    MS cares :-)
fatalis>    and riaa/mpaa etc
Mook>       umm, if you do it completely offline and don't share with anyone, I doubt they would :p
Mook>       (or at least, can tell :p )

So it seems like, if you distribute GPL'd code with your theme (such as CSS files derived from the Firefox default theme or from any theme which was itself derived from Firefox or otherwise GPL'd, which most themes are) then anything distributed with your theme must also be licensed under the GPL, which makes it free for anyone to use, modify, and distribute as long as they agree to abide by the GPL if they turn around and distribute it.

I suppose if you sat down and wrote all your theme's CSS rules from scratch, without looking at any other GPL'd theme as an example, never having even seen the source code for a Firefox theme (the "Silicon Valley Virgin Test"), then your work could be considered original and not subject to the GPL.

Then we have a contrary opinion:

magneto>    lately i've seen a lot of football-team (like OSU, broncos etc) themes coming through ... anyone know how the intellectual property issues are handled with these?
magneto>    if you distribute media in conjunction with GPL'd code i thought the media also became GPL'd which i'm sure the broncos don't want
shaver>     no, that's not what happens
magneto>    ok so i'm misinformed
magneto>    i'll have to read up on that
Themes and the Firefox World: Conclusion

This concludes the part of the article which focuses on themes and the Firefox world. Armed with what you've learned in this section, this might be a good time to review the pitfalls of theme development discussed in topic "Hidden Traps of Theme Development", or read on for a discussion of Part Six: Miscellaneous Topics.