From 50019b2831c73b35b50502fe863a045cc98f3622 Mon Sep 17 00:00:00 2001 From: petemill Date: Mon, 1 Jul 2019 09:44:12 -0700 Subject: [PATCH] New Tab Page: fix DCHECK Check `IsSafeToSetWebUIProperties()` inside a call from `WebContentsObserver::RenderViewReady` Fix https://github.com/brave/brave-browser/issues/5086 --- browser/ui/webui/brave_new_tab_ui.cc | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/browser/ui/webui/brave_new_tab_ui.cc b/browser/ui/webui/brave_new_tab_ui.cc index f16b6d1a8d1b..e7f78323187b 100644 --- a/browser/ui/webui/brave_new_tab_ui.cc +++ b/browser/ui/webui/brave_new_tab_ui.cc @@ -30,12 +30,14 @@ BraveNewTabUI::~BraveNewTabUI() { } void BraveNewTabUI::UpdateWebUIProperties() { - // TODO(petemill): move all this data to set on loadTimeData - // on the DataSource via the MessageHandler - auto* render_view_host = GetRenderViewHost(); - SetStatsWebUIProperties(render_view_host); - SetPrivateWebUIProperties(render_view_host); - SetPreferencesWebUIProperties(render_view_host); + if (IsSafeToSetWebUIProperties()) { + // TODO(petemill): move all this data to set on loadTimeData + // on the DataSource via the MessageHandler + auto* render_view_host = GetRenderViewHost(); + SetStatsWebUIProperties(render_view_host); + SetPrivateWebUIProperties(render_view_host); + SetPreferencesWebUIProperties(render_view_host); + } } void BraveNewTabUI::SetStatsWebUIProperties(