Bug 1003095 - Refactor main.js to be worker friendly;r=past