Allow non-DOM usage within Web Workers.

Fixes #1053.