Skip to content

Commit

Permalink
New Tab Page: fix DCHECK
Browse files Browse the repository at this point in the history
Check `IsSafeToSetWebUIProperties()` inside a call from `WebContentsObserver::RenderViewReady`
Fix brave/brave-browser#5086
  • Loading branch information
petemill committed Jul 1, 2019
1 parent 5f2f55d commit 50019b2
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions browser/ui/webui/brave_new_tab_ui.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 50019b2

Please sign in to comment.