Commit graph

31 commits

Author SHA1 Message Date
Tete17
18199f8f2a LibWeb: Hook TrustedTypes to the ServiceWorkers api 2025-10-13 13:22:01 +01:00
Tete17
74aa7e8a82 LibWeb: Hook TrustedTypes to the Workers api 2025-10-13 13:22:01 +01:00
Tete17
e6ac064a34 LibWeb: Hook TrustedTypes to the SharedWorkers api 2025-10-13 13:22:01 +01:00
Tete17
bd4e3fd3e0 LibWeb: Hook TrustedTypes to the Range Dom api 2025-10-13 13:22:01 +01:00
Tete17
f7c05013c7 LibWeb: Add innerText attribute of HTMLScriptElement for TrustedTypes 2025-09-16 10:57:34 +02:00
Tete17
6b9c44390f LibWeb: Add textContent attribute of HTMLScriptElement for TrustedTypes 2025-09-16 10:57:34 +02:00
Tete17
f65dca1b53 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.
2025-09-16 10:57:34 +02:00
Tete17
664a3b536a LibWeb: Extend set_text of HTMLScriptElement to accommodate TrustedTypes 2025-09-16 10:57:34 +02:00
Tete17
b6a16ed3c6 LibWeb: Implement get_trusted_type_compliant_string algorithm 2025-09-01 16:19:24 +01:00
Tete17
ab82c4c5fc LibWeb: Implement Content Security Check for sink types 2025-09-01 16:19:24 +01:00
Tete17
a5c631aff3 LibWeb: Implement Does Sink Require Trusted Types algo 2025-09-01 16:19:24 +01:00
Tete17
8df173e1bd LibWeb: Add require-trusted-types-for Directive
This is meant to configure the behaviour of an injection sinks when a
string is passed.
2025-09-01 16:19:24 +01:00
Tete17
2083708897 LibWeb: Enumerate all injection sinks relevant to the TrustedTypes spec
This enables us to more strictly control the available sinks we support.
2025-09-01 16:19:24 +01:00
Tete17
af933c2721 LibWeb: Implement last 2 remaining FIXME's on TrustedTypePolicyFactory
emptyHTML is used to avoid having to create a no-op policy while
emptyScript is used to detect if the browser supports the spec natively.
2025-09-01 16:19:24 +01:00
Tete17
4f9eb78b9d LibWeb: Refactor magic string in favour of TrustedTypeName 2025-09-01 16:19:24 +01:00
Tete17
cf211cf99a LibWeb: Migrate TrustedTypes to Utf16String 2025-08-11 12:21:31 +01:00
Tete17
53e0f287d1 LibWeb: Implement reporting of trusted-types-policy violations 2025-08-11 12:21:31 +01:00
Tete17
bc9e67a0dc LibWeb: Implement methods dependant on TrustedScriptURL 2025-08-11 12:21:31 +01:00
Tete17
adaad653ca LibWeb: Implement TrustedScriptURL class 2025-08-11 12:21:31 +01:00
Tete17
40691bf25d LibWeb: Implement methods dependant on TrustedScript 2025-08-11 12:21:31 +01:00
Tete17
56cab6955a LibWeb: Implement TrustedScript type
This turns out to be very similar to TrustedHTML.
2025-08-11 12:21:31 +01:00
Tete17
c84c97b339 LibWeb: Implement createHTML for TrustedTypePolicy
This is the main mechanism by which users of the api can create
safe object with a callback for any needed sanitation of the values.
2025-08-11 12:21:31 +01:00
Tete17
966e00fd69 LibWeb: Finish algorithm to block trusted type policy creation with CSP
This is the mechanism that should pages to determine what kind of
policies can be created on their domains mostly based around the HTTP
headers the server responds with.
2025-08-11 12:21:31 +01:00
Tete17
6398e771a3 LibWeb: Implement create_policy function for TrustedTypePolicyFactory
It simply consists of a wrapper around the main algorithm
2025-08-11 12:21:31 +01:00
Tete17
90bcc16a7b LibWeb: Add TrustedTypePolicy class
It is mostly a skeleton with no actual implementation.
2025-08-11 12:21:31 +01:00
Tete17
a73c082f36 LibWeb: Implement is_html method for TrustedTypePolicyFactory
This is used to check the legitimacy of a TrustedHTML object.
2025-08-11 12:21:31 +01:00
Tete17
0a147aa9a1 LibWeb: Implement TrustedHTML class
The TrustedHTML interface represents a string that a developer can
confidently insert into an injection sink that will render it as HTML.

These objects are immutable wrappers around a string, constructed via a
TrustedTypePolicy’s createHTML method.
2025-08-11 12:21:31 +01:00
Tete17
68c55b0ef1 LibWeb: Implement getPropertyType for TrustedTypePolicyFactory
This allows authors to check if a Trusted Type is required for the given
Elements property.

This adds 28 more passing WPT tests :)
2025-08-11 12:21:31 +01:00
Tete17
5a40115b86 LibWeb: Implement getAttributeType for TrustedTypePolicyFactory
This allows authors to check if Trusted Type is required for a given
Element's content attribute. This allows to pass the correct type
when they call to Element.setAttribute.
2025-07-30 15:51:35 +01:00
Tete17
8fdd9b68dc LibWeb: First implementation of the TrustedTypePolicyFactory
Most of the functions are either not implemented of filled with dummy
values.
2025-07-30 15:51:35 +01:00
Sam Atkins
03a058ba5e LibWeb: Update Document.write spec steps
The spec changes seem to mostly be about introducing a TrustedHTML type
which we do not yet support, so we have a couple of FIXMEs.

TrustedTypes::InjectionSink is an attempt at matching the spec, but it's
not entirely clear to me how it should work. I'm sure it'll get
revisited once we start implementing trusted types.
2025-02-25 15:19:38 +01:00