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

Issue 2042283002: Postpone JS calls from CoreOobeHandler until the JS side gets initialized (Closed)

Created:
4 years, 6 months ago by emaxx
Modified:
4 years, 6 months ago
Reviewers:
xiyuan
CC:
chromium-reviews, dzhioev+watch_chromium.org, achuith+watch_chromium.org, oshima+watch_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

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. Committed: https://crrev.com/e873b56e4b1cec5bdb3ccf6e8b7ccd5e97d94c37 Cr-Commit-Position: refs/heads/master@{#398342}

Patch Set 1 #

Total comments: 9

Patch Set 2 : Fix review nits, add comment near the tricky code #

Patch Set 3 : Add forgotten include #

Unified diffs Side-by-side diffs Delta from patch set Stats (+93 lines, -23 lines) Patch
M chrome/browser/ui/webui/chromeos/login/core_oobe_handler.h View 1 3 chunks +31 lines, -0 lines 0 comments Download
M chrome/browser/ui/webui/chromeos/login/core_oobe_handler.cc View 1 2 9 chunks +62 lines, -23 lines 0 comments Download

Messages

Total messages: 16 (7 generated)
emaxx
Hi Xiyuan, PTAL.
4 years, 6 months ago (2016-06-07 16:09:34 UTC) #3
xiyuan
Cool. https://codereview.chromium.org/2042283002/diff/1/chrome/browser/ui/webui/chromeos/login/core_oobe_handler.cc File chrome/browser/ui/webui/chromeos/login/core_oobe_handler.cc (right): https://codereview.chromium.org/2042283002/diff/1/chrome/browser/ui/webui/chromeos/login/core_oobe_handler.cc#newcode176 chrome/browser/ui/webui/chromeos/login/core_oobe_handler.cc:176: &CoreOobeHandler::ExecuteDeferredJSCall< Is it possible to base::Bind to CallJS ...
4 years, 6 months ago (2016-06-07 16:43:03 UTC) #5
emaxx
https://codereview.chromium.org/2042283002/diff/1/chrome/browser/ui/webui/chromeos/login/core_oobe_handler.cc File chrome/browser/ui/webui/chromeos/login/core_oobe_handler.cc (right): https://codereview.chromium.org/2042283002/diff/1/chrome/browser/ui/webui/chromeos/login/core_oobe_handler.cc#newcode176 chrome/browser/ui/webui/chromeos/login/core_oobe_handler.cc:176: &CoreOobeHandler::ExecuteDeferredJSCall< On 2016/06/07 16:43:03, xiyuan wrote: > Is it ...
4 years, 6 months ago (2016-06-07 17:11:13 UTC) #6
xiyuan
lgtm https://codereview.chromium.org/2042283002/diff/1/chrome/browser/ui/webui/chromeos/login/core_oobe_handler.cc File chrome/browser/ui/webui/chromeos/login/core_oobe_handler.cc (right): https://codereview.chromium.org/2042283002/diff/1/chrome/browser/ui/webui/chromeos/login/core_oobe_handler.cc#newcode176 chrome/browser/ui/webui/chromeos/login/core_oobe_handler.cc:176: &CoreOobeHandler::ExecuteDeferredJSCall< On 2016/06/07 17:11:13, emaxx wrote: > On ...
4 years, 6 months ago (2016-06-07 17:14:14 UTC) #7
emaxx
Thanks for the fast review! I added another one-line patch to add a forgotten include ...
4 years, 6 months ago (2016-06-07 17:17:12 UTC) #8
xiyuan
slgtm Thank you for taking care this long standing issue. :)
4 years, 6 months ago (2016-06-07 17:19:05 UTC) #9
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/2042283002/40001
4 years, 6 months ago (2016-06-07 18:03:27 UTC) #12
commit-bot: I haz the power
Committed patchset #3 (id:40001)
4 years, 6 months ago (2016-06-07 18:14:04 UTC) #14
commit-bot: I haz the power
4 years, 6 months ago (2016-06-07 18:17:06 UTC) #16
Message was sent while issue was closed.
Patchset 3 (id:??) landed as
https://crrev.com/e873b56e4b1cec5bdb3ccf6e8b7ccd5e97d94c37
Cr-Commit-Position: refs/heads/master@{#398342}

Powered by Google App Engine
This is Rietveld 408576698