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 314c671eb3a639b26024e92e530807b18cae6116..00832b5b8724636ad562c8528fcaca1d92a2e40b 100644 |
--- a/chrome/browser/resources/chromeos/login/login_shared.js |
+++ b/chrome/browser/resources/chromeos/login/login_shared.js |
@@ -280,6 +280,16 @@ 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. |
+ * External script using ForTesting APIs should wait for this condition. |
+ * @type {boolean} |
+ */ |
+ Oobe.readyForTesting = false; |
+ |
+ /** |
* Skip to login screen for telemetry. |
*/ |
Oobe.skipToLoginForTesting = function() { |
@@ -440,6 +450,7 @@ disableTextSelectAndDrag(function(e) { |
document.addEventListener('DOMContentLoaded', function() { |
Oobe.initialize(); |
+ Oobe.readyForTesting = true; |
}); |
// Install a global error handler so stack traces are included in logs. |
@@ -447,4 +458,3 @@ disableTextSelectAndDrag(function(e) { |
console.error(error.stack); |
} |
})(); |
- |