LibWeb/CSP: Implement the script-src-elem directive

This commit is contained in:
Luke Wilde 2024-12-03 15:24:07 +00:00 committed by Shannon Booth
commit f382bccc3d
Notes: github-actions[bot] 2025-07-12 01:07:54 +00:00
5 changed files with 111 additions and 0 deletions

View file

@ -16,6 +16,7 @@
#include <LibWeb/ContentSecurityPolicy/Directives/Names.h>
#include <LibWeb/ContentSecurityPolicy/Directives/ObjectSourceDirective.h>
#include <LibWeb/ContentSecurityPolicy/Directives/ScriptSourceDirective.h>
#include <LibWeb/ContentSecurityPolicy/Directives/ScriptSourceElementDirective.h>
namespace Web::ContentSecurityPolicy::Directives {
@ -45,6 +46,9 @@ GC::Ref<Directive> create_directive(GC::Heap& heap, String name, Vector<String>
if (name == Names::ScriptSrc)
return heap.allocate<ScriptSourceDirective>(move(name), move(value));
if (name == Names::ScriptSrcElem)
return heap.allocate<ScriptSourceElementDirective>(move(name), move(value));
return heap.allocate<Directive>(move(name), move(value));
}