diff options
-rw-r--r-- | Userland/Applications/Browser/BrowserWindow.cpp | 8 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/Page/Page.h | 5 | ||||
-rw-r--r-- | Userland/Services/WebContent/ConnectionFromClient.cpp | 4 |
3 files changed, 17 insertions, 0 deletions
diff --git a/Userland/Applications/Browser/BrowserWindow.cpp b/Userland/Applications/Browser/BrowserWindow.cpp index eb7c25064c..69d596be80 100644 --- a/Userland/Applications/Browser/BrowserWindow.cpp +++ b/Userland/Applications/Browser/BrowserWindow.cpp @@ -430,6 +430,14 @@ void BrowserWindow::build_menus() scripting_enabled_action->set_checked(true); debug_menu.add_action(scripting_enabled_action); + auto block_pop_ups_action = GUI::Action::create_checkable( + "Block Pop-ups", [this](auto& action) { + active_tab().view().debug_request("block-pop-ups", action.is_checked() ? "on" : "off"); + }, + this); + block_pop_ups_action->set_checked(true); + debug_menu.add_action(block_pop_ups_action); + auto same_origin_policy_action = GUI::Action::create_checkable( "Enable Same Origin &Policy", [this](auto& action) { active_tab().view().debug_request("same-origin-policy", action.is_checked() ? "on" : "off"); diff --git a/Userland/Libraries/LibWeb/Page/Page.h b/Userland/Libraries/LibWeb/Page/Page.h index e9046d8a95..b07541ca04 100644 --- a/Userland/Libraries/LibWeb/Page/Page.h +++ b/Userland/Libraries/LibWeb/Page/Page.h @@ -71,6 +71,9 @@ public: bool is_scripting_enabled() const { return m_is_scripting_enabled; } void set_is_scripting_enabled(bool b) { m_is_scripting_enabled = b; } + bool should_block_pop_ups() const { return m_should_block_pop_ups; } + void set_should_block_pop_ups(bool b) { m_should_block_pop_ups = b; } + bool is_webdriver_active() const { return m_is_webdriver_active; } void set_is_webdriver_active(bool b) { m_is_webdriver_active = b; } @@ -91,6 +94,8 @@ private: bool m_is_scripting_enabled { true }; + bool m_should_block_pop_ups { true }; + // https://w3c.github.io/webdriver/#dfn-webdriver-active-flag // The webdriver-active flag is set to true when the user agent is under remote control. It is initially false. bool m_is_webdriver_active { false }; diff --git a/Userland/Services/WebContent/ConnectionFromClient.cpp b/Userland/Services/WebContent/ConnectionFromClient.cpp index 50b376dbd8..5d31679859 100644 --- a/Userland/Services/WebContent/ConnectionFromClient.cpp +++ b/Userland/Services/WebContent/ConnectionFromClient.cpp @@ -248,6 +248,10 @@ void ConnectionFromClient::debug_request(String const& request, String const& ar m_page_host->page().set_is_scripting_enabled(argument == "on"); } + if (request == "block-pop-ups") { + m_page_host->page().set_should_block_pop_ups(argument == "on"); + } + if (request == "dump-local-storage") { if (auto* doc = page().top_level_browsing_context().active_document()) doc->window().local_storage()->dump(); |