From dc894c6742a25a4f708410582711f555c5d14ffd Mon Sep 17 00:00:00 2001 From: dbeam Date: Thu, 9 Oct 2014 23:00:58 -0700 Subject: [PATCH] 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} --- chrome/browser/resources/history/history.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/chrome/browser/resources/history/history.js b/chrome/browser/resources/history/history.js index 3e91e7bb00dc..5d91c4dace5d 100644 --- a/chrome/browser/resources/history/history.js +++ b/chrome/browser/resources/history/history.js @@ -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. + } }; /** -- 2.11.4.GIT