Bug 842745 - Modify timer in JS shell function to take an arbitrary JS function. r=dvander