[bug 1017850] Check for localstorage

Apologies for the apparent size of this. I fixed the indentation.

r?