From 780e5441b4aa7f6b14921429f0841bc23ebdc7dc Mon Sep 17 00:00:00 2001 From: Linus Groh Date: Wed, 30 Mar 2022 23:23:14 +0100 Subject: [PATCH] WebContent: Add plumbing for 'is scripting enabled' setting --- Userland/Services/WebContent/ConnectionFromClient.cpp | 5 +++++ Userland/Services/WebContent/ConnectionFromClient.h | 1 + Userland/Services/WebContent/PageHost.cpp | 5 +++++ Userland/Services/WebContent/PageHost.h | 1 + Userland/Services/WebContent/WebContentServer.ipc | 2 +- 5 files changed, 13 insertions(+), 1 deletion(-) diff --git a/Userland/Services/WebContent/ConnectionFromClient.cpp b/Userland/Services/WebContent/ConnectionFromClient.cpp index 20a975d959..0c0f93be38 100644 --- a/Userland/Services/WebContent/ConnectionFromClient.cpp +++ b/Userland/Services/WebContent/ConnectionFromClient.cpp @@ -459,4 +459,9 @@ void ConnectionFromClient::set_has_focus(bool has_focus) m_page_host->set_has_focus(has_focus); } +void ConnectionFromClient::set_is_scripting_enabled(bool is_scripting_enabled) +{ + m_page_host->set_is_scripting_enabled(is_scripting_enabled); +} + } diff --git a/Userland/Services/WebContent/ConnectionFromClient.h b/Userland/Services/WebContent/ConnectionFromClient.h index abcfa96c18..f0a4a3f34b 100644 --- a/Userland/Services/WebContent/ConnectionFromClient.h +++ b/Userland/Services/WebContent/ConnectionFromClient.h @@ -61,6 +61,7 @@ private: virtual void set_content_filters(Vector const&) override; virtual void set_preferred_color_scheme(Web::CSS::PreferredColorScheme const&) override; virtual void set_has_focus(bool) override; + virtual void set_is_scripting_enabled(bool) override; virtual void js_console_input(String const&) override; virtual void run_javascript(String const&) override; diff --git a/Userland/Services/WebContent/PageHost.cpp b/Userland/Services/WebContent/PageHost.cpp index 5a23732afc..de45226257 100644 --- a/Userland/Services/WebContent/PageHost.cpp +++ b/Userland/Services/WebContent/PageHost.cpp @@ -62,6 +62,11 @@ void PageHost::set_preferred_color_scheme(Web::CSS::PreferredColorScheme color_s document->invalidate_style(); } +void PageHost::set_is_scripting_enabled(bool is_scripting_enabled) +{ + page().set_is_scripting_enabled(is_scripting_enabled); +} + Web::Layout::InitialContainingBlock* PageHost::layout_root() { auto* document = page().top_level_browsing_context().active_document(); diff --git a/Userland/Services/WebContent/PageHost.h b/Userland/Services/WebContent/PageHost.h index 4aeded7d50..6ccc38d04c 100644 --- a/Userland/Services/WebContent/PageHost.h +++ b/Userland/Services/WebContent/PageHost.h @@ -33,6 +33,7 @@ public: void set_should_show_line_box_borders(bool b) { m_should_show_line_box_borders = b; } void set_has_focus(bool); + void set_is_scripting_enabled(bool); private: // ^PageClient diff --git a/Userland/Services/WebContent/WebContentServer.ipc b/Userland/Services/WebContent/WebContentServer.ipc index b5a10d8711..a4b9b01122 100644 --- a/Userland/Services/WebContent/WebContentServer.ipc +++ b/Userland/Services/WebContent/WebContentServer.ipc @@ -44,7 +44,7 @@ endpoint WebContentServer set_content_filters(Vector filters) =| set_preferred_color_scheme(Web::CSS::PreferredColorScheme color_scheme) =| - set_has_focus(bool has_focus) =| + set_is_scripting_enabled(bool is_scripting_enabled) =| }