mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-12-07 21:59:54 +00:00
LibWeb: Modify DomParser parseFromString to accept TrustedHTML
We made the internal changes to accept this new type, but we forgot to expose it.
This commit is contained in:
parent
901afee50b
commit
42284f8006
Notes:
github-actions[bot]
2025-12-01 08:55:42 +00:00
Author: https://github.com/tete17
Commit: 42284f8006
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6630
Reviewed-by: https://github.com/gmta ✅
5 changed files with 8 additions and 9 deletions
|
|
@ -39,7 +39,7 @@ void DOMParser::initialize(JS::Realm& realm)
|
|||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-domparser-parsefromstring
|
||||
WebIDL::ExceptionOr<GC::Root<DOM::Document>> DOMParser::parse_from_string(Utf16String string, Bindings::DOMParserSupportedType type)
|
||||
WebIDL::ExceptionOr<GC::Root<DOM::Document>> DOMParser::parse_from_string(TrustedTypes::TrustedHTMLOrString string, Bindings::DOMParserSupportedType type)
|
||||
{
|
||||
// 1. Let compliantString to the result of invoking the Get Trusted Type compliant string algorithm with
|
||||
// TrustedHTML, this's relevant global object, string, "DOMParser parseFromString", and "script".
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ public:
|
|||
|
||||
virtual ~DOMParser() override;
|
||||
|
||||
WebIDL::ExceptionOr<GC::Root<DOM::Document>> parse_from_string(Utf16String, Bindings::DOMParserSupportedType type);
|
||||
WebIDL::ExceptionOr<GC::Root<DOM::Document>> parse_from_string(TrustedTypes::TrustedHTMLOrString, Bindings::DOMParserSupportedType type);
|
||||
|
||||
private:
|
||||
explicit DOMParser(JS::Realm&);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
#import <DOM/Document.idl>
|
||||
#import <TrustedTypes/TrustedHTML.idl>
|
||||
|
||||
enum DOMParserSupportedType {
|
||||
"text/html",
|
||||
|
|
@ -13,5 +14,5 @@ enum DOMParserSupportedType {
|
|||
interface DOMParser {
|
||||
constructor();
|
||||
|
||||
Document parseFromString(Utf16DOMString string, DOMParserSupportedType type);
|
||||
Document parseFromString((TrustedHTML or Utf16DOMString) string, DOMParserSupportedType type);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -2,9 +2,8 @@ Harness status: OK
|
|||
|
||||
Found 5 tests
|
||||
|
||||
4 Pass
|
||||
1 Fail
|
||||
Fail document.innerText assigned via policy (successful HTML transformation).
|
||||
5 Pass
|
||||
Pass document.innerText assigned via policy (successful HTML transformation).
|
||||
Pass `document.innerText = string` throws.
|
||||
Pass 'document.innerText = null' throws
|
||||
Pass 'document.innerText = string' assigned via default policy (successful HTML transformation).
|
||||
|
|
|
|||
|
|
@ -2,9 +2,8 @@ Harness status: OK
|
|||
|
||||
Found 4 tests
|
||||
|
||||
3 Pass
|
||||
1 Fail
|
||||
Fail createHTML with a policy that returns undefined DOMParser
|
||||
4 Pass
|
||||
Pass createHTML with a policy that returns undefined DOMParser
|
||||
Pass createHTML with a policy that returns undefined iframe.srcdoc
|
||||
Pass createScript with a policy that returns undefined <div onload>
|
||||
Pass createScriptURL with a policy that returns undefined script.src
|
||||
Loading…
Add table
Add a link
Reference in a new issue