Fixes #3752 - Better setTimeout logic. Previously, it would always do
two refreshes, the second one after a setTimeout of 1s. Now, it only
does the setTimeout if actually needed (usually not), and if
needed, then keep looping for 10 tries until shapes.css is properly
loaded.