mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 08:57:34 +00:00
LibWeb: Add 'should block pop ups' user config to Page
This will also be used by the window.open algorithm steps.
This commit is contained in:
parent
ff2f31bc81
commit
798d7c6fae
3 changed files with 17 additions and 0 deletions
|
@ -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");
|
||||
|
|
|
@ -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 };
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue