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

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

Issue 2805033002: Fix flaky NPE in oobe.js. (Closed)
Patch Set: address comments. 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 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);
}
})();
-
« 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