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.

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

Lithium's general syntax is:

    ./lithium.py (interestingness-test) (file-to-reduce) [extra arguments for the test]

You'll usually be able to use one of the tests that comes with Lithium:

TestParametersWhat it tests
outputs.shapp, X(App run with the testcase) outputs X
outputs1.shapp, X, Y(App run with the testcase) outputs X but not Y
crashes.pyapp, [timeout=300](App run with the testcase) crashes
hangs.pyapp, [timeout=30](App run with the testcase) does not exit within the timeout, in seconds

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

    ./lithium.py ./outputs.sh boom.html fxdebug/firefox-bin "ASSERTION: index out of range"

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

Tips

All operating systems

Mac

Windows