Skip to content

Commit

Permalink
Merge pull request #10002 from brave/pr9984_issues/17864_1.30.x
Browse files Browse the repository at this point in the history
Add check if javascript was disallowed. (uplift to 1.30.x)
  • Loading branch information
kjozwiak committed Sep 9, 2021
2 parents cc4b335 + 7983d43 commit 377cedd
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,7 @@ void BraveNewTabMessageHandler::OnJavascriptDisallowed() {
if (tor_launcher_factory_)
tor_launcher_factory_->RemoveObserver(this);
#endif
weak_ptr_factory_.InvalidateWeakPtrs();
}

void BraveNewTabMessageHandler::HandleGetPreferences(
Expand Down Expand Up @@ -726,6 +727,11 @@ void BraveNewTabMessageHandler::HandleTodayGetDisplayAd(
if (!handler) {
return;
}

if (!handler->IsJavascriptAllowed()) {
return;
}

if (!success) {
handler->ResolveJavascriptCallback(base::Value(callback_id),
std::move(base::Value()));
Expand Down

0 comments on commit 377cedd

Please sign in to comment.