Handle window.localStorage === null case correctly.

Change-Id: I49ddf45093daee4988fb7f3b481fb35bfaceb152
Mingle: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/521
Bug: 64525
Merge "Handle window.localStorage === null case correctly."