mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-01 05:39:11 +00:00
LibWeb/Loader: Add filtering_enabled
flag in ContentFilter
This allows us to toggle content filtering on or off. Default is set to true to match current behavior.
This commit is contained in:
parent
a6efdb1068
commit
00aa72c16e
Notes:
github-actions[bot]
2025-03-10 12:31:37 +00:00
Author: https://github.com/rmg-x
Commit: 00aa72c16e
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3844
Reviewed-by: https://github.com/AtkinsSJ ✅
2 changed files with 7 additions and 0 deletions
|
@ -21,6 +21,9 @@ ContentFilter::~ContentFilter() = default;
|
|||
|
||||
bool ContentFilter::is_filtered(const URL::URL& url) const
|
||||
{
|
||||
if (!filtering_enabled())
|
||||
return false;
|
||||
|
||||
if (url.scheme() == "data")
|
||||
return false;
|
||||
|
||||
|
|
|
@ -16,6 +16,9 @@ class ContentFilter {
|
|||
public:
|
||||
static ContentFilter& the();
|
||||
|
||||
bool filtering_enabled() const { return m_filtering_enabled; }
|
||||
void set_filtering_enabled(bool const enabled) { m_filtering_enabled = enabled; }
|
||||
|
||||
bool is_filtered(const URL::URL&) const;
|
||||
ErrorOr<void> set_patterns(ReadonlySpan<String>);
|
||||
|
||||
|
@ -27,6 +30,7 @@ private:
|
|||
String text;
|
||||
};
|
||||
Vector<Pattern> m_patterns;
|
||||
bool m_filtering_enabled { true };
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue