Chromium Code Reviews| 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. |