Commit f9379757 authored by mukai@chromium.org's avatar mukai@chromium.org

Fixes a crash caused for update of webkit notifications.

If update happens with different ids, it essentially means a removal
and an add from notification_list point of view. Sending Update() will
confuse the observers.

It is possible to pass both ids for Update(), but handling update of
different ids on each observer doesn't make much sense. It will be better
to send both Removed() and Added() in this case.

BUG=233221
TEST=manually on the reported page in the bug

Review URL: https://chromiumcodereview.appspot.com/14127003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@195346 0039d316-1c4b-4281-b951-d872f2087c98
parent 8649d108
......@@ -106,8 +106,15 @@ void MessageCenterImpl::UpdateNotification(
const base::DictionaryValue* optional_fields) {
notification_list_->UpdateNotificationMessage(
old_id, new_id, title, message, optional_fields);
FOR_EACH_OBSERVER(MessageCenterObserver, observer_list_,
OnNotificationUpdated(new_id));
if (old_id == new_id) {
FOR_EACH_OBSERVER(MessageCenterObserver, observer_list_,
OnNotificationUpdated(new_id));
} else {
FOR_EACH_OBSERVER(MessageCenterObserver, observer_list_,
OnNotificationRemoved(old_id, false));
FOR_EACH_OBSERVER(MessageCenterObserver, observer_list_,
OnNotificationAdded(new_id));
}
}
void MessageCenterImpl::RemoveNotification(const std::string& id,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment