1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 01:17:35 +00:00

Browser+Ladybird+LibWeb: Port content filters to String

This commit is contained in:
Timothy Flynn 2023-04-21 07:54:56 -04:00 committed by Andreas Kling
parent 76ae60da15
commit 5089766af6
11 changed files with 23 additions and 22 deletions

View file

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

View file

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