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

Unified Diff: ui/webui/resources/cr_elements/cr_dialog/cr_dialog.js

Issue 2249933002: WebUI cr-dialog: Cancel dialog on any 'popstate' event. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 months 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/webui/resources/cr_elements/cr_dialog/cr_dialog.js
diff --git a/ui/webui/resources/cr_elements/cr_dialog/cr_dialog.js b/ui/webui/resources/cr_elements/cr_dialog/cr_dialog.js
index 5deb50cdea1c893c1fb7a77c852029fbd5397bd3..fc13095d5eec9c815c1c54e713b4f6206a0a0f11 100644
--- a/ui/webui/resources/cr_elements/cr_dialog/cr_dialog.js
+++ b/ui/webui/resources/cr_elements/cr_dialog/cr_dialog.js
@@ -15,6 +15,16 @@ Polymer({
is: 'cr-dialog',
extends: 'dialog',
+ /** @override */
+ created: function() {
+ // If the active history entry changes (i.e. user clicks back button),
+ // all open dialogs should be cancelled.
+ window.addEventListener('popstate', function() {
Dan Beam 2016/08/16 01:30:43 tsergeant@/calamity@/mahmadi@: does this behavior
+ if (this.open)
+ this.cancel();
+ }.bind(this));
+ },
+
cancel: function() {
this.fire('cancel');
HTMLDialogElement.prototype.close.call(this, '');
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698