Fix exceptions when running mocha in Web Workers.

This is a minimal change that makes mocha not crash when running a test suite in a Web Worker environment, per the discussion in https://github.com/visionmedia/mocha/pull/780

Given the constraints in the discussion above, the Web Worker environment is not covered by tests, so mocha might break in Web workers again in the future.