Browser tests inherited from chromeos::LoginManagerTest are flaky and produce JS errors |
||
Issue descriptionChrome OS tests inherited from LoginManagerTest produce pretty often JavaScript errors like these: * [ERROR:CONSOLE(1)] "Uncaught ReferenceError: cr is not defined", source: (1) * [ERROR:CONSOLE(1)] "Uncaught TypeError: Cannot read property 'reloadContent' of undefined", source: (1) Examples of test classes that produce these errors (unreliably): LoginUITest, LoginStateNotificationBlockerChromeOSBrowserTest, LoginTest, LoginSigninTest. Some of these tests are also flaky (however, not sure whether for the same reason).
,
May 25 2016
I may be wrong, but I think the problem is that LoginDisplayHostImpl::StartWizard calls LoadURL(GURL(kOobeURL)) and, without any waiting for the completion, WizardController::Init. This assumption was based on the fact that JS error occurred in the result of the following chain of calls: LoginDisplayHostImpl::StartWizard -> WizardController::Init -> WizardController::AdvanceToScreen -> [async] WizardController::OnHIDScreenNecessityCheck -> WizardController::ShowNetworkScreen -> NetworkScreen::Initialize -> NetworkScreen::ScheduleResolveLanguageList -> [async] NetworkScreenHandler::ReloadLocalizedContent -> CoreOobeHandler::ReloadContent Xiyuan, WDYT?
,
May 26 2016
Thanks for digging into this. The analysis looks correct to me.
Essentially, we should wait until one of the cr.ui.Oobe.initiliaze [1] is called. It should do chrome.send('screenStateInitialize') at the end and CoreOobeHandler::HandleInitialized gets that. We should defer all JS calls until this has happened.
[1]: There are three of those: oobe.js, login.js and lock.js. e.g.
https://code.google.com/p/chromium/codesearch#chromium/src/chrome/browser/resources/chromeos/login/oobe.js&l=69
,
Jun 7 2016
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/e873b56e4b1cec5bdb3ccf6e8b7ccd5e97d94c37 commit e873b56e4b1cec5bdb3ccf6e8b7ccd5e97d94c37 Author: emaxx <emaxx@chromium.org> Date: Tue Jun 07 18:13:51 2016 Postpone JS calls from CoreOobeHandler until the JS side gets initialized This fixes a race between loading JavaScript code and calling methods from it. The race was caused by CoreOobeHandler class whose methods (like ReloadContent) called JavaScript methods directly, while there was a possibility that JavaScript files defining them were not loaded yet. This was observed, for example, when running tests inherited from LoginManagerTest, as the form of the following errors printed into console: * [ERROR:CONSOLE(1)] "Uncaught ReferenceError: cr is not defined", source: (1) * [ERROR:CONSOLE(1)] "Uncaught TypeError: Cannot read property 'reloadContent' of undefined", source: (1) This CL adds a new condition that doesn't allow to call JS methods until 'screenStateInitialize' message is received from JS side. Any attempts to call JS method too early are deferred and executed when the 'screenStateInitialize' is finally received. BUG= 614805 TEST=manual: run login-related tests and check that no JavaScript errors appear in the console. Review-Url: https://codereview.chromium.org/2042283002 Cr-Commit-Position: refs/heads/master@{#398342} [modify] https://crrev.com/e873b56e4b1cec5bdb3ccf6e8b7ccd5e97d94c37/chrome/browser/ui/webui/chromeos/login/core_oobe_handler.cc [modify] https://crrev.com/e873b56e4b1cec5bdb3ccf6e8b7ccd5e97d94c37/chrome/browser/ui/webui/chromeos/login/core_oobe_handler.h
,
Dec 2 2016
|
||
►
Sign in to add a comment |
||
Comment 1 by emaxx@chromium.org
, May 25 2016