refactor(storage): instantiate localStorage from a factory

Fixes #1921.

@ckarlof r?
Let's remove support for sessionStorage unless we're using it.