mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 15:28:11 +00:00
LibWeb+LibWebView+WebContent: Add APIs to manage an autoplay allowlist
The spec defines a Permissions Policy to control some browser behaviors on a per-origin basis. Management of these permissions live in their own spec: https://w3c.github.io/webappsec-permissions-policy/ This implements a somewhat ad-hoc Permissions Policy for autoplaying media elements. We will need to implement the entire policy spec for this to be more general.
This commit is contained in:
parent
6131e621d6
commit
7966fc4780
12 changed files with 209 additions and 0 deletions
|
@ -30,6 +30,7 @@
|
|||
#include <LibWeb/Loader/ResourceLoader.h>
|
||||
#include <LibWeb/Painting/PaintableBox.h>
|
||||
#include <LibWeb/Painting/StackingContext.h>
|
||||
#include <LibWeb/PermissionsPolicy/AutoplayAllowlist.h>
|
||||
#include <LibWeb/Platform/EventLoopPlugin.h>
|
||||
#include <WebContent/ConnectionFromClient.h>
|
||||
#include <WebContent/PageHost.h>
|
||||
|
@ -639,6 +640,18 @@ void ConnectionFromClient::set_content_filters(Vector<DeprecatedString> const& f
|
|||
Web::ContentFilter::the().add_pattern(filter);
|
||||
}
|
||||
|
||||
void ConnectionFromClient::set_autoplay_allowed_on_all_websites()
|
||||
{
|
||||
auto& autoplay_allowlist = Web::PermissionsPolicy::AutoplayAllowlist::the();
|
||||
autoplay_allowlist.enable_globally();
|
||||
}
|
||||
|
||||
void ConnectionFromClient::set_autoplay_allowlist(Vector<String> const& allowlist)
|
||||
{
|
||||
auto& autoplay_allowlist = Web::PermissionsPolicy::AutoplayAllowlist::the();
|
||||
autoplay_allowlist.enable_for_origins(allowlist).release_value_but_fixme_should_propagate_errors();
|
||||
}
|
||||
|
||||
void ConnectionFromClient::set_proxy_mappings(Vector<DeprecatedString> const& proxies, HashMap<DeprecatedString, size_t> const& mappings)
|
||||
{
|
||||
auto keys = mappings.keys();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue