Error in local storage - NS_ERROR_FILE_CORRUPTED - firefox

Juan Jardim picture Juan Jardim · Sep 18, 2013 · Viewed 23.8k times · Source

I've been working in a web application and I'm using local storage. But for some Firefox users I notice that they're having the following error:

NS_ERROR_FILE_CORRUPTED: Component returned failure code: 0x8052000b (NS_ERROR_FILE_CORRUPTED) [nsIDOMStorage.setItem]

when it called the function:

function setLocalStorageItem(key, value){ 
        localStorage.setItem(key, JSON.stringify(value));
}

It's is a way to avoid this error?

Answer

Volker E. picture Volker E. · Oct 15, 2014

After an OS crash files within the Firefox profile folder might be corrupt and lead to non-functional websites (in my case ironically the Firefox marketplace). Here, webappsstore.sqlite was affected.

As user @Oli stated over at Ask Ubuntu

Firefox stores its HTML5 data in a file called webappsstore.sqlite. That's sitting in your profile directory which lurks somewhere in ~/.mozilla/firefox/....default/ (depending on what your profile is called).

Move that out the way and restart Firefox and everything will come back to life.

More: https://developer.mozilla.org/en/dom/storage

If deleted/moved out of your profile folder, Firefox builds a new, sanitized webappsstore.sqlite file. Worked for me.
Information on where to find your profile folder can be accessed here.