mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-28 10:37:17 +02:00
LibWeb: Extend src attribute of HTMLScriptElement with TrustedTypes
The field does no longer have the Reflect and URL attributes so we remove it from our internal unit test.
This commit is contained in:
committed by
Jelle Raaijmakers
parent
664a3b536a
commit
f65dca1b53
Notes:
github-actions[bot]
2025-09-16 08:58:57 +00:00
Author: https://github.com/tete17 Commit: https://github.com/LadybirdBrowser/ladybird/commit/f65dca1b533 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6058 Reviewed-by: https://github.com/AtkinsSJ Reviewed-by: https://github.com/gmta ✅
@@ -661,6 +661,23 @@ WebIDL::ExceptionOr<void> HTMLScriptElement::set_text(TrustedTypes::TrustedScrip
|
||||
return {};
|
||||
}
|
||||
|
||||
// https://www.w3.org/TR/trusted-types/#the-src-idl-attribute
|
||||
WebIDL::ExceptionOr<void> HTMLScriptElement::set_src(TrustedTypes::TrustedScriptURLOrString text)
|
||||
{
|
||||
// 1. Let value be the result of calling Get Trusted Type compliant string with
|
||||
// TrustedScriptURL, this’s relevant global object, the given value, HTMLScriptElement src, and script.
|
||||
auto const value = TRY(TrustedTypes::get_trusted_type_compliant_string(
|
||||
TrustedTypes::TrustedTypeName::TrustedScriptURL,
|
||||
HTML::relevant_global_object(*this),
|
||||
text,
|
||||
TrustedTypes::InjectionSink::HTMLScriptElementsrc,
|
||||
TrustedTypes::Script.to_string()));
|
||||
|
||||
// 2. Set this’s src content attribute to value.
|
||||
TRY(set_attribute(AttributeNames::src, value));
|
||||
return {};
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/scripting.html#dom-script-async
|
||||
bool HTMLScriptElement::async() const
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user