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

Unified Diff: chrome/browser/resources/chromeos/login/login_shared.js

Issue 2825453002: Update readyForTesting var even on Oobe.initialize() failure. (Closed)
Patch Set: Created 3 years, 8 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: chrome/browser/resources/chromeos/login/login_shared.js
diff --git a/chrome/browser/resources/chromeos/login/login_shared.js b/chrome/browser/resources/chromeos/login/login_shared.js
index 00832b5b8724636ad562c8528fcaca1d92a2e40b..80d7978a3270feeb5dfaae5fbfe66bce4db8328b 100644
--- a/chrome/browser/resources/chromeos/login/login_shared.js
+++ b/chrome/browser/resources/chromeos/login/login_shared.js
@@ -282,12 +282,17 @@ cr.define('cr.ui', function() {
/**
* Some ForTesting APIs directly access to DOM. Because this script is loaded
* in header, DOM tree may not be available at beginning.
- * In DOMContentLoaded, this is marked to true, indicating ForTesting methods
- * can be called.
+ * This is initialized to null, indicating that DOM is not yet loaded. Then
+ * marked to "true" on success of Oobe initialization, or "false" on failure,
+ * which runs after DOM loading is done.
+ * If "true" is set, external scripts can call ForTesting APIs defined in
+ * this module.
+ * Note that "false" is explicitly set there to notify the caller that
+ * the initialization is failed, so it is not necessary to wait for timeout.
* External script using ForTesting APIs should wait for this condition.
- * @type {boolean}
+ * @type {?boolean}
*/
- Oobe.readyForTesting = false;
+ Oobe.readyForTesting = null;
/**
* Skip to login screen for telemetry.
@@ -449,8 +454,13 @@ disableTextSelectAndDrag(function(e) {
'use strict';
document.addEventListener('DOMContentLoaded', function() {
- Oobe.initialize();
- Oobe.readyForTesting = true;
achuithb 2017/04/17 08:42:08 What happens if you move this line to before Oobe.
hidehiko 2017/04/17 09:32:27 Acknowledged.
+ try {
+ Oobe.initialize();
+ Oobe.readyForTesting = true;
+ } catch (e) {
+ Oobe.readyForTesting = false;
+ throw e;
+ }
});
// Install a global error handler so stack traces are included in logs.
« 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