Make loading images sync in the parser case, and make selecting an image...

... async in the scripted case. Fixes #152 Fixes https://www.w3.org/Bugs/Public/show_bug.cgi?id=25848