Fixing bug 340144. Crash if calling sessionStorage.removeItem() with a non-existing key. r=enndeakin@sympatico.ca, sr=bzbarsky@mit.edu

This commit is contained in:
jst%mozilla.jstenback.com 2006-06-19 23:48:07 +00:00
parent 82333c8b3b
commit 1eebb3195b

View File

@ -369,16 +369,20 @@ NS_IMETHODIMP nsDOMStorage::RemoveItem(const nsAString& aKey)
NS_ENSURE_SUCCESS(rv, rv);
mItemsCached = PR_FALSE;
BroadcastChangeNotification();
#endif
}
else if (entry) {
// clear string as StorageItems may be referencing this item
entry->mItem->ClearValue();
BroadcastChangeNotification();
}
mItems.RawRemoveEntry(entry);
BroadcastChangeNotification();
if (entry) {
mItems.RawRemoveEntry(entry);
}
return NS_OK;
}