LibWeb/CSP: Implement the connect-src directive

This commit is contained in:
Luke Wilde 2024-11-28 16:35:12 +00:00 committed by Shannon Booth
commit 959bb5cc18
Notes: github-actions[bot] 2025-07-05 09:23:11 +00:00
7 changed files with 124 additions and 0 deletions

View file

@ -5,13 +5,18 @@
*/
#include <LibJS/Runtime/Realm.h>
#include <LibWeb/ContentSecurityPolicy/Directives/ConnectSourceDirective.h>
#include <LibWeb/ContentSecurityPolicy/Directives/Directive.h>
#include <LibWeb/ContentSecurityPolicy/Directives/DirectiveFactory.h>
#include <LibWeb/ContentSecurityPolicy/Directives/Names.h>
namespace Web::ContentSecurityPolicy::Directives {
GC::Ref<Directive> create_directive(GC::Heap& heap, String name, Vector<String> value)
{
if (name == Names::ConnectSrc)
return heap.allocate<ConnectSourceDirective>(move(name), move(value));
return heap.allocate<Directive>(move(name), move(value));
}