summaryrefslogtreecommitdiff
path: root/Userland/Services/WebContent
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-09-27 11:39:17 +0200
committerAndreas Kling <kling@serenityos.org>2021-09-27 11:40:56 +0200
commita79bdd2bd544c6111c1e5c2876af4875f613437b (patch)
tree27cf923ab66add87f2521e3ddcfaff722ba4a2ba /Userland/Services/WebContent
parentb0858b2a55814291bf822007a3a0c5aea5455a56 (diff)
downloadserenity-a79bdd2bd544c6111c1e5c2876af4875f613437b.zip
LibWeb+Browser: Make ad blocking work in the multi-process world
We now send the list of content filters over to new WebContent processes after creating an OutOfProcessWebView. :^)
Diffstat (limited to 'Userland/Services/WebContent')
-rw-r--r--Userland/Services/WebContent/ClientConnection.cpp7
-rw-r--r--Userland/Services/WebContent/ClientConnection.h1
-rw-r--r--Userland/Services/WebContent/WebContentServer.ipc3
3 files changed, 11 insertions, 0 deletions
diff --git a/Userland/Services/WebContent/ClientConnection.cpp b/Userland/Services/WebContent/ClientConnection.cpp
index e3c48c5d01..0032be4353 100644
--- a/Userland/Services/WebContent/ClientConnection.cpp
+++ b/Userland/Services/WebContent/ClientConnection.cpp
@@ -19,6 +19,7 @@
#include <LibWeb/DOM/Document.h>
#include <LibWeb/Dump.h>
#include <LibWeb/Layout/InitialContainingBlock.h>
+#include <LibWeb/Loader/ContentFilter.h>
#include <LibWeb/Loader/ResourceLoader.h>
#include <LibWeb/Page/BrowsingContext.h>
#include <WebContent/ClientConnection.h>
@@ -338,4 +339,10 @@ Messages::WebContentServer::DumpLayoutTreeResponse ClientConnection::dump_layout
return builder.to_string();
}
+void ClientConnection::set_content_filters(Vector<String> const& filters)
+{
+ for (auto& filter : filters)
+ Web::ContentFilter::the().add_pattern(filter);
+}
+
}
diff --git a/Userland/Services/WebContent/ClientConnection.h b/Userland/Services/WebContent/ClientConnection.h
index 7a0f116c88..79fe50f866 100644
--- a/Userland/Services/WebContent/ClientConnection.h
+++ b/Userland/Services/WebContent/ClientConnection.h
@@ -55,6 +55,7 @@ private:
virtual Messages::WebContentServer::InspectDomNodeResponse inspect_dom_node(i32) override;
virtual Messages::WebContentServer::GetHoveredNodeIdResponse get_hovered_node_id() override;
virtual Messages::WebContentServer::DumpLayoutTreeResponse dump_layout_tree() override;
+ virtual void set_content_filters(Vector<String> const&) override;
virtual void js_console_input(String const&) override;
virtual void run_javascript(String const&) override;
diff --git a/Userland/Services/WebContent/WebContentServer.ipc b/Userland/Services/WebContent/WebContentServer.ipc
index a8307c784f..a79859d381 100644
--- a/Userland/Services/WebContent/WebContentServer.ipc
+++ b/Userland/Services/WebContent/WebContentServer.ipc
@@ -38,4 +38,7 @@ endpoint WebContentServer
get_selected_text() => (String selection)
select_all() =|
+
+ set_content_filters(Vector<String> filters) =|
+
}