Bug 870043 - Factor the watchdog machinery into a helper class. r=mrbkap

This is a long-overdue change in general. It's now particularly necessary
because we want to start and stop the watchdog, potentially multiple times
during a session. Encapsulating this into a class that we can
destroy/instantiate several times means that we don't end up with inconsistent
state.

As a nice bonus, this centralizes the whole setup and makes it easier to
comprehend. I actually had this nicely split up into several patches, but
I accidentally squashed them while rebasing. :-(
Bug 870043 - Add a script-accessible statistics for various watchdog events. r=mrbkap

We need this even for testing wakeups, because we can't be certain that any
given operation callback was necessarily triggered from the watchdog thread
(since it's triggered from within the JS engine in various cases as well).
Bug 870043 - Add support for scripted operation callbacks in XPCShell. r=mrbkap
Bug 870043 - Add a way to simulate the JSRuntime activity callback from xpcshell. r=mrbkap

The JS engine fires this callback when the request count drops to zero, and we
use it determine when we should hibernate the watchdog thread. But since the
request count never drops to zero for nested event loops, the watchdog never
runs in those cases. And since our xpcshell harness runs tests in a nested event
loop, this means we can't test watchdog hibernation from xpcshell. And we don't
want to test it in mochitests, because the non-determinism of timer CCs and GCs
are likely to be problematic.

Really, we should consider finding a way to integrate nested event loops into
the activity callback mechanism, and should probably get a bug on file. But such
a task is out of scope for this bug, so we just add a way to fake it.
Bug 870043 - Watchdog tests. r=mrbkap
Bug 870043 - Disable the watchdog on b2g. r=mrbkap