refactor(storage): instantiate localStorage from a factory

Fixes #1921.
Merge pull request #1923 from mozilla/issue-1921-refactor-localstorage

refactor(storage): instantiate localStorage from a factory

r=ckarlof
Fixes #1921