Using Lithium to reduce bugs in Firefox

Lithium has been used it to make reduced testcases for hundreds of crashes and assertion bugs in Firefox. Here's how.

Preparing the testcase

If the testcase is pure JavaScript with no DOM interaction, use the command-line JavaScript Shell instead of Firefox, as it will be much faster to start the process each time.

If the testcase has to run in Firefox:

  1. Make the testcase cause Firefox to exit when finished, using goQuitApplication() in examples/mozilla/quit.js.
  2. Tell Lithium what section of the testcase file it is allowed to reduce, by adding comment lines containing "DDBEGIN" and "DDEND" to the file. This prevents Lithium from needlessly introducing syntax errors or removing the goQuitApplication() call.

Running Lithium

You'll usually be able to use one of the tests that comes with Lithium. For these tests, the "..." means (app with args, including testcase).

TestParametersWhat it tests
outputs_timed.pytimeout, string, app+argsapp+args outputs string (on stdout or stderr) within timeout seconds.
hangs.pytimeout, app+argsapp+args does not exit within timeout seconds.
crashes.pytimeout, app+argsapp+args crashes (Mac-only)timeout, signature, app+argsapp+args crashes, with signature somewhere in the crash log. Recommend using a function near the top of the stack trace.

For example, suppose you have a large file called boom.html that triggers an array-bound assertion in debug builds of Firefox. To make a reduced testcase, you might use something like:

    ./ 120 "ASSERTION: index out of range" fxdebug/firefox-bin boom.html

Lithium will try to remove as many lines from boom.html as possible while still causing Firefox to print that assertion message.


All operating systems