1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 16:07:45 +00:00

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. :^)
This commit is contained in:
Andreas Kling 2021-09-27 11:39:17 +02:00
parent b0858b2a55
commit a79bdd2bd5
8 changed files with 22 additions and 4 deletions

View file

@ -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);
}
}

View file

@ -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;

View file

@ -38,4 +38,7 @@ endpoint WebContentServer
get_selected_text() => (String selection)
select_all() =|
set_content_filters(Vector<String> filters) =|
}