Commit dc894c67 authored by dbeam's avatar dbeam Committed by Commit bot

history: fix delete regression when Delete is held down.

R=dmazzoni@chromium.org
BUG=419272
TEST=hold delete on history page => no assertions or double messages

Review URL: https://codereview.chromium.org/643013002

Cr-Commit-Position: refs/heads/master@{#299064}
parent c92f12a4
......@@ -489,10 +489,8 @@ Visit.prototype.showMoreFromSite_ = function() {
*/
Visit.prototype.handleKeydown_ = function(e) {
// Delete or Backspace should delete the entry if allowed.
if ((e.keyIdentifier == 'U+0008' || e.keyIdentifier == 'U+007F') &&
!this.model_.isDeletingVisits()) {
if (e.keyIdentifier == 'U+0008' || e.keyIdentifier == 'U+007F')
this.removeEntryFromHistory_(e);
}
};
/**
......@@ -501,8 +499,10 @@ Visit.prototype.handleKeydown_ = function(e) {
* @private
*/
Visit.prototype.removeEntryFromHistory_ = function(e) {
if (!this.model_.deletingHistoryAllowed)
if (!this.model_.deletingHistoryAllowed || this.model_.isDeletingVisits() ||
this.domNode_.classList.contains('fade-out')) {
return;
}
this.model_.getView().onBeforeRemove(this);
this.removeFromHistory();
......@@ -1219,8 +1219,10 @@ HistoryView.prototype.removeVisit = function(visit) {
HistoryView.prototype.onEntryRemoved = function() {
this.updateSelectionEditButtons();
if (this.model_.getSize() == 0)
if (this.model_.getSize() == 0) {
this.clear_();
this.onModelReady(true); // Shows "No entries" message.
}
};
/**
......
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