PDA

View Full Version : BUG: Ext.data.WebStorageProxy doesn't handle QUOTA_EXCEEDED_ERR



JacobGu
8 Aug 2011, 8:18 AM
The method setIds in Ext.data.WebStorageProxy calls localStorage/sessionStorage.setItem, but does not handle a possible QUOTA_EXCEEDED_ERR exception that is thrown when the storage usage caps at 5MB.

The method should look something like this:




setIds: function(ids) {
var obj = this.getStorageObject(),
str = ids.join(",");

obj.removeItem(this.id);

if (!Ext.isEmpty(str)) { try {
obj.setItem(this.id, str); } catch(e){ if((e.name).toUpperCase() == 'QUOTA_EXCEEDED_ERR'){ // do something here (fire error event, etc.) } // else throw event to caller }
}
},