mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-30 00:31:14 +00:00
Browser+WebContent: Add a Debug menu action to disable scripting :^)
This commit is contained in:
parent
780e5441b4
commit
04e40b7aaa
Notes:
sideshowbarker
2024-07-17 16:25:43 +09:00
Author: https://github.com/linusg Commit: https://github.com/SerenityOS/serenity/commit/04e40b7aaa Pull-request: https://github.com/SerenityOS/serenity/pull/13375
|
@ -378,6 +378,14 @@ void BrowserWindow::build_menus()
|
|||
m_user_agent_spoof_actions.add_action(custom_user_agent);
|
||||
|
||||
debug_menu.add_separator();
|
||||
auto scripting_enabled_action = GUI::Action::create_checkable(
|
||||
"Enable Scripting", [this](auto& action) {
|
||||
active_tab().m_web_content_view->debug_request("scripting", action.is_checked() ? "on" : "off");
|
||||
},
|
||||
this);
|
||||
scripting_enabled_action->set_checked(true);
|
||||
debug_menu.add_action(scripting_enabled_action);
|
||||
|
||||
auto same_origin_policy_action = GUI::Action::create_checkable(
|
||||
"Enable Same Origin &Policy", [this](auto& action) {
|
||||
active_tab().m_web_content_view->debug_request("same-origin-policy", action.is_checked() ? "on" : "off");
|
||||
|
|
|
@ -223,6 +223,10 @@ void ConnectionFromClient::debug_request(const String& request, const String& ar
|
|||
m_page_host->page().set_same_origin_policy_enabled(argument == "on");
|
||||
}
|
||||
|
||||
if (request == "scripting") {
|
||||
m_page_host->page().set_is_scripting_enabled(argument == "on");
|
||||
}
|
||||
|
||||
if (request == "dump-local-storage") {
|
||||
if (auto* doc = page().top_level_browsing_context().active_document())
|
||||
doc->window().local_storage()->dump();
|
||||
|
|
Loading…
Reference in a new issue