mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 05:27:45 +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;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue