Fixes for Safari

Webkit-based browsers don’t have native base64 functions in web
workers, so a shim had to be added.

Also fixed a strange bug only affecting iOS Safari that caused entries
to seemingly disappear from the WebSQL database. async handle creation
was moved into a function, which is called inside $(window).load