hrtimer

hrtimer is a project that includes hrprofiler,
a new profiler for Javascript in Mozilla, hrcov, a tool
for Javascript code coverage, and hrtimer proper, a
facility for script to directly access various system timers and
metrics.

hrcov

hrcov is a simple code coverage tool for Javascript. It
will list all scripts Firefox knows about, and the lines of
which that were not executed in a given time period. No other
similar tool exists for Javascript currently. As of January
2008, the only tools available are a Firebug plugin that only
gives function coverage, and a preprocessor. hrcov is
the only Javascript code coverage tool that provides
line-by-line coverage information.

The main use case for hrcov is unit testing: we want
to be able to ensure that a unit test covers all aspects of a
given piece of functionality.

Like all hrtimer tools, hrcov works equally
well with content and chrome code.

outline

hrcov can divide a source file into chunks and report
on the coverage of each chunk separately. It divides files the
same way Emacs'
outline-mode does, and understands the same format of file
variables.
For example, look at ffhrcov_result.js. At the end of the file, we have:

// Local Variables:
// outline-regexp: "// ==+\\s-+"
// End:

This block means that consecutive sections of the file are
separated by lines beginning with "// ==", a variable number
of '=' signs, and more space. hrcov will automatically
figure out file sectioning based on these lines and display
the results as a tree in the coverage report.