Fixing bug 340144. Fix crash when sessionStorage.removeItem() is called with a non-existent key. r=enndeakin@sympatico.ca, sr=bzbarsky@mit.edu, a=bzbarsky@mit.edu

git-svn-id: svn://10.0.0.236/branches/MOZILLA_1_8_BRANCH@200469 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
jst%mozilla.jstenback.com
2006-06-20 21:59:55 +00:00
parent 5b8053add6
commit 3beb487488

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;
}
@@ -886,6 +890,7 @@ nsresult
nsDOMStorageEvent::Init()
{
nsresult rv = InitEvent(NS_LITERAL_STRING("storage"), PR_TRUE, PR_FALSE);
NS_ENSURE_SUCCESS(rv, rv);
// This init method is only called by native code, so set the
// trusted flag here.