mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-20 19:45:12 +00:00
WebContent+UI/Qt: Add debug option to toggle content filtering on/off
This was needed by @piruzzolo on Discord for debugging purposes and seems pretty useful :^)
This commit is contained in:
parent
00aa72c16e
commit
c361ea8916
Notes:
github-actions[bot]
2025-03-10 12:31:30 +00:00
Author: https://github.com/rmg-x Commit: https://github.com/LadybirdBrowser/ladybird/commit/c361ea89164 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3844 Reviewed-by: https://github.com/AtkinsSJ ✅
5 changed files with 24 additions and 0 deletions
|
@ -415,6 +415,11 @@ void ConnectionFromClient::debug_request(u64 page_id, ByteString request, ByteSt
|
|||
Web::ResourceLoader::the().set_navigator_compatibility_mode(compatibility_mode);
|
||||
return;
|
||||
}
|
||||
|
||||
if (request == "content-filtering") {
|
||||
Web::ContentFilter::the().set_filtering_enabled(argument == "on");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void ConnectionFromClient::get_source(u64 page_id)
|
||||
|
|
|
@ -569,6 +569,17 @@ BrowserWindow::BrowserWindow(Vector<URL::URL> const& initial_urls, IsPopupWindow
|
|||
});
|
||||
});
|
||||
|
||||
m_enable_content_filtering_action = new QAction("Enable Content Filtering", this);
|
||||
m_enable_content_filtering_action->setCheckable(true);
|
||||
m_enable_content_filtering_action->setChecked(true);
|
||||
debug_menu->addAction(m_enable_content_filtering_action);
|
||||
QObject::connect(m_enable_content_filtering_action, &QAction::triggered, this, [this] {
|
||||
bool const state = m_enable_content_filtering_action->isChecked();
|
||||
for_each_tab([state](auto& tab) {
|
||||
tab.set_content_filtering(state);
|
||||
});
|
||||
});
|
||||
|
||||
m_block_pop_ups_action = new QAction("Block Pop-ups", this);
|
||||
m_block_pop_ups_action->setCheckable(true);
|
||||
m_block_pop_ups_action->setChecked(WebView::Application::chrome_options().allow_popups == WebView::AllowPopups::No);
|
||||
|
@ -828,6 +839,7 @@ void BrowserWindow::initialize_tab(Tab* tab)
|
|||
|
||||
tab->set_line_box_borders(m_show_line_box_borders_action->isChecked());
|
||||
tab->set_scripting(m_enable_scripting_action->isChecked());
|
||||
tab->set_content_filtering(m_enable_content_filtering_action->isChecked());
|
||||
tab->set_block_popups(m_block_pop_ups_action->isChecked());
|
||||
tab->set_same_origin_policy(m_enable_same_origin_policy_action->isChecked());
|
||||
tab->set_user_agent_string(user_agent_string());
|
||||
|
|
|
@ -205,6 +205,7 @@ private:
|
|||
QAction* m_inspect_dom_node_action { nullptr };
|
||||
QAction* m_show_line_box_borders_action { nullptr };
|
||||
QAction* m_enable_scripting_action { nullptr };
|
||||
QAction* m_enable_content_filtering_action { nullptr };
|
||||
QAction* m_block_pop_ups_action { nullptr };
|
||||
QAction* m_enable_same_origin_policy_action { nullptr };
|
||||
|
||||
|
|
|
@ -982,6 +982,11 @@ void Tab::set_scripting(bool enabled)
|
|||
debug_request("scripting", enabled ? "on" : "off");
|
||||
}
|
||||
|
||||
void Tab::set_content_filtering(bool const enabled)
|
||||
{
|
||||
debug_request("content-filtering", enabled ? "on" : "off");
|
||||
}
|
||||
|
||||
void Tab::set_user_agent_string(ByteString const& user_agent)
|
||||
{
|
||||
debug_request("spoof-user-agent", user_agent);
|
||||
|
|
|
@ -91,6 +91,7 @@ public:
|
|||
void set_line_box_borders(bool);
|
||||
void set_same_origin_policy(bool);
|
||||
void set_scripting(bool);
|
||||
void set_content_filtering(bool);
|
||||
void set_user_agent_string(ByteString const&);
|
||||
void set_navigator_compatibility_mode(ByteString const&);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue