| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 /** | 5 /** |
| 6 * @fileoverview Common OOBE controller methods. This method is shared between | 6 * @fileoverview Common OOBE controller methods. This method is shared between |
| 7 * OOBE, login, and the lock screen. Add only methods that need to be shared | 7 * OOBE, login, and the lock screen. Add only methods that need to be shared |
| 8 * between all *three* screens here, as each additional method increases the | 8 * between all *three* screens here, as each additional method increases the |
| 9 * time it takes to show the lock screen. | 9 * time it takes to show the lock screen. |
| 10 * | 10 * |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 /** | 275 /** |
| 276 * Restores input focus to currently selected pod. | 276 * Restores input focus to currently selected pod. |
| 277 */ | 277 */ |
| 278 Oobe.refocusCurrentPod = function() { | 278 Oobe.refocusCurrentPod = function() { |
| 279 DisplayManager.refocusCurrentPod(); | 279 DisplayManager.refocusCurrentPod(); |
| 280 }; | 280 }; |
| 281 | 281 |
| 282 /** | 282 /** |
| 283 * Some ForTesting APIs directly access to DOM. Because this script is loaded | 283 * Some ForTesting APIs directly access to DOM. Because this script is loaded |
| 284 * in header, DOM tree may not be available at beginning. | 284 * in header, DOM tree may not be available at beginning. |
| 285 * In DOMContentLoaded, this is marked to true, indicating ForTesting methods | 285 * In DOMContentLoaded, after Oobe.initialize() is done, this is marked to |
| 286 * can be called. | 286 * true, indicating ForTesting methods can be called. |
| 287 * External script using ForTesting APIs should wait for this condition. | 287 * External script using ForTesting APIs should wait for this condition. |
| 288 * @type {boolean} | 288 * @type {boolean} |
| 289 */ | 289 */ |
| 290 Oobe.readyForTesting = false; | 290 Oobe.readyForTesting = false; |
| 291 | 291 |
| 292 /** | 292 /** |
| 293 * Skip to login screen for telemetry. | 293 * Skip to login screen for telemetry. |
| 294 */ | 294 */ |
| 295 Oobe.skipToLoginForTesting = function() { | 295 Oobe.skipToLoginForTesting = function() { |
| 296 Oobe.disableSigninUI(); | 296 Oobe.disableSigninUI(); |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 442 return src instanceof HTMLTextAreaElement || | 442 return src instanceof HTMLTextAreaElement || |
| 443 src instanceof HTMLInputElement && | 443 src instanceof HTMLInputElement && |
| 444 /text|password|search/.test(src.type); | 444 /text|password|search/.test(src.type); |
| 445 }); | 445 }); |
| 446 | 446 |
| 447 | 447 |
| 448 (function() { | 448 (function() { |
| 449 'use strict'; | 449 'use strict'; |
| 450 | 450 |
| 451 document.addEventListener('DOMContentLoaded', function() { | 451 document.addEventListener('DOMContentLoaded', function() { |
| 452 Oobe.initialize(); | 452 try { |
| 453 Oobe.readyForTesting = true; | 453 Oobe.initialize(); |
| 454 } finally { |
| 455 // TODO(crbug.com/712078): Do not set readyForTesting in case of that |
| 456 // initialize() is failed. Currently, in some situation, initialize() |
| 457 // raises an exception unexpectedly. It means testing APIs should not |
| 458 // be called then. However, checking it here now causes bots failures |
| 459 // unfortunately. So, as a short term workaround, here set |
| 460 // readyForTesting even on failures, just to make test bots happy. |
| 461 Oobe.readyForTesting = true; |
| 462 } |
| 454 }); | 463 }); |
| 455 | 464 |
| 456 // Install a global error handler so stack traces are included in logs. | 465 // Install a global error handler so stack traces are included in logs. |
| 457 window.onerror = function(message, file, line, column, error) { | 466 window.onerror = function(message, file, line, column, error) { |
| 458 console.error(error.stack); | 467 console.error(error.stack); |
| 459 } | 468 } |
| 460 })(); | 469 })(); |
| OLD | NEW |