mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-12-07 21:59:54 +00:00
LibWeb: Allow eval to execute TrustedScripts
This commit is contained in:
parent
fb2062a9db
commit
6d173d931a
Notes:
github-actions[bot]
2025-11-11 08:59:45 +00:00
Author: https://github.com/tete17
Commit: 6d173d931a
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6649
Reviewed-by: https://github.com/Lubrsi
Reviewed-by: https://github.com/gmta ✅
1 changed files with 4 additions and 2 deletions
|
|
@ -125,8 +125,10 @@ void initialize_main_thread_vm(AgentType type)
|
|||
};
|
||||
|
||||
// 8.1.6.3 HostGetCodeForEval(argument), https://html.spec.whatwg.org/multipage/webappapis.html#hostgetcodeforeval(argument)
|
||||
s_main_thread_vm->host_get_code_for_eval = [](JS::Object const&) -> GC::Ptr<JS::PrimitiveString> {
|
||||
// FIXME: 1. If argument is a TrustedScript object, then return argument's data.
|
||||
s_main_thread_vm->host_get_code_for_eval = [](JS::Object const& argument) -> GC::Ptr<JS::PrimitiveString> {
|
||||
// 1. If argument is a TrustedScript object, then return argument's data.
|
||||
if (auto const* trusted_script = as_if<TrustedTypes::TrustedScript>(argument); trusted_script)
|
||||
return JS::PrimitiveString::create(argument.vm(), trusted_script->to_string());
|
||||
|
||||
// 2. Otherwise, return no-code.
|
||||
return {};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue