Skip to content

Commit 3f63898

Browse files
committed
Uplift of #29127 (squashed) to beta
1 parent 1b61937 commit 3f63898

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

browser/ui/webui/brave_shields/shields_panel_data_handler.cc

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,17 +186,25 @@ void ShieldsPanelDataHandler::OpenWebCompatWindow() {
186186

187187
void ShieldsPanelDataHandler::AreAnyBlockedElementsPresent(
188188
AreAnyBlockedElementsPresentCallback callback) {
189+
if (!active_shields_data_controller_) {
190+
return;
191+
}
192+
189193
std::move(callback).Run(
190194
g_brave_browser_process->ad_block_service()->AreAnyBlockedElementsPresent(
191195
active_shields_data_controller_->web_contents()->GetURL().host()));
192196
}
193197

194198
void ShieldsPanelDataHandler::ResetBlockedElements() {
199+
webui_controller_->embedder()->CloseUI();
200+
201+
if (!active_shields_data_controller_) {
202+
return;
203+
}
204+
195205
g_brave_browser_process->ad_block_service()->ResetCosmeticFilter(
196206
active_shields_data_controller_->web_contents()->GetURL().host());
197207

198-
webui_controller_->embedder()->CloseUI();
199-
200208
active_shields_data_controller_->web_contents()->GetController().Reload(
201209
content::ReloadType::NORMAL, true);
202210
}

0 commit comments

Comments
 (0)