Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2730)

Unified Diff: chrome/browser/resources/md_history/app.js

Issue 2404763002: Refactor overall test suite, use replaceApp in HistoryListTest (Closed)
Patch Set: Undo namespacing change Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/md_history/app.js
diff --git a/chrome/browser/resources/md_history/app.js b/chrome/browser/resources/md_history/app.js
index c0dbb18a500611cfc0f8a7e112cfe6348a483d02..774449360b619897bc8e7d218b9c3103bbe8e5a1 100644
--- a/chrome/browser/resources/md_history/app.js
+++ b/chrome/browser/resources/md_history/app.js
@@ -107,13 +107,28 @@ Polymer({
'unselect-all': 'unselectAll',
},
+ /** @private {?function(!Event)} */
+ onCanExecuteListener_: null,
+
+ /** @private {?function(!Event)} */
+ onCommandListener_: null,
+
/** @override */
- ready: function() {
+ attached: function() {
this.grouped_ = loadTimeData.getBoolean('groupByDomain');
cr.ui.decorate('command', cr.ui.Command);
- document.addEventListener('canExecute', this.onCanExecute_.bind(this));
- document.addEventListener('command', this.onCommand_.bind(this));
+ this.onCanExecuteListener_ = this.onCanExecute_.bind(this);
Dan Beam 2016/11/03 18:07:51 nit: boundOnCanExecute_ seems to be the typical po
tsergeant 2016/11/03 22:34:32 Done.
+ this.onCommandListener_ = this.onCommand_.bind(this);
+
+ document.addEventListener('canExecute', this.onCanExecuteListener_);
+ document.addEventListener('command', this.onCommandListener_);
+ },
+
+ /** @override */
+ detached: function() {
+ document.removeEventListener('canExecute', this.onCanExecuteListener_);
+ document.removeEventListener('command', this.onCommandListener_);
},
onFirstRender: function() {

Powered by Google App Engine
This is Rietveld 408576698