refactor(storage): instantiate localStorage from a factory

Fixes #1921.

@ckarlof r?
Reason is that sometimes this doesn't return a `localStorage` backed `Storage` instance.