mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 02:17:35 +00:00
Browser+Ladybird+LibWeb: Port content filters to String
This commit is contained in:
parent
76ae60da15
commit
5089766af6
11 changed files with 23 additions and 22 deletions
|
@ -33,7 +33,7 @@ bool ContentFilter::is_filtered(const AK::URL& url) const
|
|||
return false;
|
||||
}
|
||||
|
||||
ErrorOr<void> ContentFilter::set_patterns(ReadonlySpan<DeprecatedString> patterns)
|
||||
ErrorOr<void> ContentFilter::set_patterns(ReadonlySpan<String> patterns)
|
||||
{
|
||||
m_patterns.clear_with_capacity();
|
||||
|
||||
|
@ -46,7 +46,7 @@ ErrorOr<void> ContentFilter::set_patterns(ReadonlySpan<DeprecatedString> pattern
|
|||
if (!pattern.ends_with('*'))
|
||||
TRY(builder.try_append('*'));
|
||||
|
||||
TRY(m_patterns.try_empend(builder.to_deprecated_string()));
|
||||
TRY(m_patterns.try_empend(TRY(builder.to_string())));
|
||||
}
|
||||
|
||||
return {};
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <AK/String.h>
|
||||
#include <AK/URL.h>
|
||||
#include <AK/Vector.h>
|
||||
|
||||
|
@ -16,14 +17,14 @@ public:
|
|||
static ContentFilter& the();
|
||||
|
||||
bool is_filtered(const AK::URL&) const;
|
||||
ErrorOr<void> set_patterns(ReadonlySpan<DeprecatedString>);
|
||||
ErrorOr<void> set_patterns(ReadonlySpan<String>);
|
||||
|
||||
private:
|
||||
ContentFilter();
|
||||
~ContentFilter();
|
||||
|
||||
struct Pattern {
|
||||
DeprecatedString text;
|
||||
String text;
|
||||
};
|
||||
Vector<Pattern> m_patterns;
|
||||
};
|
||||
|
|
|
@ -595,9 +595,9 @@ OrderedHashMap<DeprecatedString, DeprecatedString> OutOfProcessWebView::get_sess
|
|||
return client().get_session_storage_entries();
|
||||
}
|
||||
|
||||
void OutOfProcessWebView::set_content_filters(Vector<DeprecatedString> filters)
|
||||
void OutOfProcessWebView::set_content_filters(Vector<String> filters)
|
||||
{
|
||||
client().async_set_content_filters(filters);
|
||||
client().async_set_content_filters(move(filters));
|
||||
}
|
||||
|
||||
void OutOfProcessWebView::set_autoplay_allowed_on_all_websites()
|
||||
|
|
|
@ -42,7 +42,7 @@ public:
|
|||
OrderedHashMap<DeprecatedString, DeprecatedString> get_local_storage_entries();
|
||||
OrderedHashMap<DeprecatedString, DeprecatedString> get_session_storage_entries();
|
||||
|
||||
void set_content_filters(Vector<DeprecatedString>);
|
||||
void set_content_filters(Vector<String>);
|
||||
void set_autoplay_allowed_on_all_websites();
|
||||
void set_autoplay_allowlist(Vector<String>);
|
||||
void set_proxy_mappings(Vector<DeprecatedString> proxies, HashMap<DeprecatedString, size_t> mappings);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue