mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-22 04:25:13 +00:00
LibWeb: Remove OOM handling from the AutoplayAllowlist
This commit is contained in:
parent
94041a28de
commit
c479ef9573
3 changed files with 7 additions and 9 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2023, Tim Flynn <trflynn89@serenityos.org>
|
||||
* Copyright (c) 2023-2025, Tim Flynn <trflynn89@ladybird.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
@ -66,27 +66,25 @@ void AutoplayAllowlist::enable_globally()
|
|||
m_allowlist = Global {};
|
||||
}
|
||||
|
||||
ErrorOr<void> AutoplayAllowlist::enable_for_origins(ReadonlySpan<String> origins)
|
||||
void AutoplayAllowlist::enable_for_origins(ReadonlySpan<String> origins)
|
||||
{
|
||||
m_allowlist = Patterns {};
|
||||
|
||||
auto& allowlist = m_allowlist->get<Patterns>();
|
||||
TRY(allowlist.try_ensure_capacity(origins.size()));
|
||||
allowlist.ensure_capacity(origins.size());
|
||||
|
||||
for (auto const& origin : origins) {
|
||||
auto url = URL::Parser::basic_parse(origin);
|
||||
|
||||
if (!url.has_value())
|
||||
url = URL::Parser::basic_parse(TRY(String::formatted("https://{}", origin)));
|
||||
url = URL::Parser::basic_parse(MUST(String::formatted("https://{}", origin)));
|
||||
if (!url.has_value()) {
|
||||
dbgln("Invalid origin for autoplay allowlist: {}", origin);
|
||||
continue;
|
||||
}
|
||||
|
||||
TRY(allowlist.try_append(url->origin()));
|
||||
allowlist.append(url->origin());
|
||||
}
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ public:
|
|||
Decision is_allowed_for_origin(DOM::Document const&, URL::Origin const&) const;
|
||||
|
||||
void enable_globally();
|
||||
ErrorOr<void> enable_for_origins(ReadonlySpan<String>);
|
||||
void enable_for_origins(ReadonlySpan<String>);
|
||||
|
||||
private:
|
||||
AutoplayAllowlist();
|
||||
|
|
|
@ -1066,7 +1066,7 @@ void ConnectionFromClient::set_autoplay_allowed_on_all_websites(u64)
|
|||
void ConnectionFromClient::set_autoplay_allowlist(u64, Vector<String> allowlist)
|
||||
{
|
||||
auto& autoplay_allowlist = Web::PermissionsPolicy::AutoplayAllowlist::the();
|
||||
autoplay_allowlist.enable_for_origins(allowlist).release_value_but_fixme_should_propagate_errors();
|
||||
autoplay_allowlist.enable_for_origins(allowlist);
|
||||
}
|
||||
|
||||
void ConnectionFromClient::set_proxy_mappings(u64, Vector<ByteString> proxies, HashMap<ByteString, size_t> mappings)
|
||||
|
|
Loading…
Add table
Reference in a new issue