LibWeb/CSP: Implement the child-src directive

This commit is contained in:
Luke Wilde
2024-12-03 18:29:41 +00:00
committed by Shannon Booth
parent c5748437db
commit 5a1de8a187
Notes: github-actions[bot] 2025-07-19 05:16:19 +00:00
5 changed files with 90 additions and 0 deletions

View File

@@ -5,6 +5,7 @@
*/
#include <LibJS/Runtime/Realm.h>
#include <LibWeb/ContentSecurityPolicy/Directives/ChildSourceDirective.h>
#include <LibWeb/ContentSecurityPolicy/Directives/ConnectSourceDirective.h>
#include <LibWeb/ContentSecurityPolicy/Directives/DefaultSourceDirective.h>
#include <LibWeb/ContentSecurityPolicy/Directives/Directive.h>
@@ -28,6 +29,9 @@ namespace Web::ContentSecurityPolicy::Directives {
GC::Ref<Directive> create_directive(GC::Heap& heap, String name, Vector<String> value)
{
if (name == Names::ChildSrc)
return heap.allocate<ChildSourceDirective>(move(name), move(value));
if (name == Names::ConnectSrc)
return heap.allocate<ConnectSourceDirective>(move(name), move(value));