Looking for Heroes

Josh Matthews, Mozilla

@lastontheboat

Getting Involved

There are two main ways to do this:

Join a team

whatcanidoformozilla.org

Fix random bugs

Bugs Ahoy!

Where does it happen?

Bugzilla: where tasks are tracked, patches attached, and reviews sought and given (here's an example).

Lots of communication happens on irc.mozilla.org. Newcomers and oldcomers are welcome in #introduction.

Other popular channels:

How does it happen?

When confused, ask someone.

#introduction is a very helpful place for these kinds of questions.

Building Firefox from scratch

There's a wiki page that has everything you need.

However, to show how easy it can be:

Full builds can take anywhere from 15 minutes (on really expensive, good hardware) to 1-2 hours (on not very good hardware).

Incremental builds: avoiding full rebuilds

It's often not necessary to rebuild everything!

If your changes don't seem to be showing up, ./mach build to be safe.

Tests

We have a lot of tests, and a lot of testing frameworks.

Almost all of these can be passed a particular test file to run.

See the automated testing wiki page for a more in-depth discussion.

Tryserver

Ask your mentor to submit your patches to our build farm for testing.

You can also (and should!) request limited commit access to do so yourself.

Debugging Firefox

Overview of Firefox's parts

Learning more about the internals of web browsers will help your understanding of Gecko's internals and the organization of Firefox's source code.

Finding what you need

MXR is your friend.

Recommended learning/searching strategies:

Mozilla uses XPCOM

Lots of IDL interfaces implemented by JavaScript and/or C++ code.

[scriptable, uuid(d32b87b3-fe96-4f42-81ab-2f39f7ec43ff)]
interface nsIGeolocationProvider : nsISupports {

  /**
   * Start up the provider.  This is called before any other
   * method.  may be called multiple times.
   */
  void startup();

  /**
   * watch
   * When a location change is observed, notify the callback. The privacy
   * argument informs the provider whether the initiating request came from
   * a private context; it is up to the provider to use that information
   * in a sensible manner.
   */
  void watch(in nsIGeolocationUpdate callback, in boolean requestPrivate);

  /**
   * shutdown
   * Shuts down the location device.
   */
  void shutdown();

  /**
   * hint to provide to use any amount of power to provide a better result
   */
  void setHighAccuracy(in boolean enable);

};

XPCOM (cont.)

eg. nsIChannel provides common interface for

eg. nsIGeolocationProvider provides interface for

XPCOM (cont.)

XPCOM types require special smart pointers,

Concrete types can implement more than one interface; use QueryInterface/GetInterface to discover them.

JS:

try {
  var httpChannel = channel.QueryInterface(Components.interfaces.nsIHttpChannel);
} catch (x) {
}

C++:

nsCOMPtr<nsIHttpChannel> httpChanel = do_QueryInterface(channel);
if (httpChannel) {
}

XPCOM (cont.)

All XPCOM components are accessible through GetService/CreateInstance.

C++:

nsCOMPtr<nsIGeolocationUpdate> geoSvc = do_GetService("@mozilla.org/geolocation/service;1");
nsCOMPtr<nsITimer> geoSvc = do_CreateInstance("@mozilla.org/timer;1");

JS:

try {
  var geoSvc = Components.classes["@mozilla.org/geolocation/service;1"].getService(Components.interfaces.nsIGeolocationUpdate);
  var timer = Components.classes["@mozilla.org/timer;1"].createInstance(Components.interfaces.nsITimer)
} catch (x) {
}

Strings

They're not weird, just different.

"Special" constructs

That's all, folks

You now know much more than most people who see Mozilla's code for the first time.

Your turn.

Remember: when in doubt, ask someone! The Mozilla community awaits you.


@lastontheboat :: josh@joshmatthews.net

/

#