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

Unified Diff: chrome/browser/resources/gaia_auth_host/authenticator.js

Issue 2380203002: cros: Fix API 'add' password and complete auth racing (Closed)
Patch Set: Created 4 years, 3 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 | chrome/browser/resources/gaia_auth_host/saml_handler.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/gaia_auth_host/authenticator.js
diff --git a/chrome/browser/resources/gaia_auth_host/authenticator.js b/chrome/browser/resources/gaia_auth_host/authenticator.js
index f4e0e9376561e327964447683f5805aa2cfac39a..b9cfd2089858467bf462bb550c8125f49d5e1a34 100644
--- a/chrome/browser/resources/gaia_auth_host/authenticator.js
+++ b/chrome/browser/resources/gaia_auth_host/authenticator.js
@@ -163,6 +163,9 @@ cr.define('cr.login', function() {
this.samlHandler_.addEventListener(
'videoEnabled',
this.onVideoEnabled_.bind(this));
+ this.samlHandler_.addEventListener(
+ 'apiPasswordAdded',
+ this.onSamlApiPasswordAdded_.bind(this));
this.webview_.addEventListener('droplink', this.onDropLink_.bind(this));
this.webview_.addEventListener(
@@ -755,6 +758,18 @@ cr.define('cr.login', function() {
};
/**
+ * Invoked when |samlHandler_| fires 'apiPasswordAdded' event.
+ * @private
+ */
+ Authenticator.prototype.onSamlApiPasswordAdded_ = function(e) {
+ // Saml API 'add' password might be received after the 'loadcommit' event.
+ // In such case, maybeCompleteAuth_ should be attempted again if oauth code
+ // is available.
+ if (this.oauthCode_)
+ this.maybeCompleteAuth_();
+ };
+
+ /**
* Invoked when a link is dropped on the webview.
* @private
*/
« no previous file with comments | « no previous file | chrome/browser/resources/gaia_auth_host/saml_handler.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698