mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-20 19:45:12 +00:00
LibWeb: Remove OOM handling from the AutoplayAllowlist
Some checks are pending
CI / Lagom (arm64, Sanitizer_CI, false, macos-15, macOS, Clang) (push) Waiting to run
CI / Lagom (x86_64, Fuzzers_CI, false, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, false, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, true, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (macos-14, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (ubuntu-24.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
Some checks are pending
CI / Lagom (arm64, Sanitizer_CI, false, macos-15, macOS, Clang) (push) Waiting to run
CI / Lagom (x86_64, Fuzzers_CI, false, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, false, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, true, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (macos-14, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (ubuntu-24.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
This commit is contained in:
parent
ed265b568d
commit
6f1710121d
Notes:
github-actions[bot]
2025-03-30 15:20:01 +00:00
Author: https://github.com/trflynn89 Commit: https://github.com/LadybirdBrowser/ladybird/commit/6f1710121d2 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4146 Reviewed-by: https://github.com/tcl3 ✅
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