diff --git a/browser/brave_shields/ad_block_service_browsertest.cc b/browser/brave_shields/ad_block_service_browsertest.cc index 74788907e8b5..49b63d48e351 100644 --- a/browser/brave_shields/ad_block_service_browsertest.cc +++ b/browser/brave_shields/ad_block_service_browsertest.cc @@ -3050,6 +3050,18 @@ IN_PROC_BROWSER_TEST_F(AdBlockServiceTest, ContentPicker) { ASSERT_TRUE(content::WaitForLoadStop(web_contents())); EXPECT_EQ(web_contents()->GetLastCommittedURL(), "chrome://settings/shields/filters"); + + ShieldsDown(tab_url); + NavigateToURL(tab_url); + { + content::ContextMenuParams params; + params.page_url = tab_url; + TestRenderViewContextMenu menu(*web_contents()->GetPrimaryMainFrame(), + params); + menu.Init(); + // No menu item if Shields are down. + EXPECT_FALSE(menu.IsItemEnabled(IDC_ADBLOCK_CONTEXT_BLOCK_ELEMENTS)); + } } #endif // !BUILDFLAG(IS_ANDROID) diff --git a/chromium_src/chrome/browser/renderer_context_menu/render_view_context_menu.cc b/chromium_src/chrome/browser/renderer_context_menu/render_view_context_menu.cc index 79495cd7562a..f64641068bdc 100644 --- a/chromium_src/chrome/browser/renderer_context_menu/render_view_context_menu.cc +++ b/chromium_src/chrome/browser/renderer_context_menu/render_view_context_menu.cc @@ -715,8 +715,9 @@ void BraveRenderViewContextMenu::AppendDeveloperItems() { auto* shields_tab_helper = brave_shields::BraveShieldsTabHelper::FromWebContents( source_web_contents_); - bool add_block_elements = - shields_tab_helper && shields_tab_helper->GetAdBlockMode() != + bool add_block_elements = shields_tab_helper && + shields_tab_helper->GetBraveShieldsEnabled() && + shields_tab_helper->GetAdBlockMode() != brave_shields::mojom::AdBlockMode::ALLOW; #if BUILDFLAG(IS_ANDROID) // Content picker doesn't available for Android. diff --git a/components/cosmetic_filters/resources/data/element_picker.ts b/components/cosmetic_filters/resources/data/element_picker.ts index 4562032a9927..30cc985d3225 100644 --- a/components/cosmetic_filters/resources/data/element_picker.ts +++ b/components/cosmetic_filters/resources/data/element_picker.ts @@ -572,4 +572,7 @@ const highlightElements = (coords: TargetRect[]) => { } } -launchElementPicker(attachElementPicker()) +const active = document.getElementById('brave-element-picker') +if (!active) { + launchElementPicker(attachElementPicker()) +}