Split up js so report-xul.js can be shared