Ensure parsers initiated from DOMParser always complete. (#33056)

* Ensure parsers initiated from DOMParser always complete.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* Add test for parseFromString with async parser.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* Add expected failure.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

---------

Signed-off-by: Josh Matthews <josh@joshmatthews.net>
This commit is contained in:
Josh Matthews 2024-08-15 19:45:00 -04:00 committed by GitHub
parent 3cc91e655f
commit 69185c4af1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 36 additions and 34 deletions

View file

@ -1,4 +1,7 @@
[responsexml-non-well-formed.htm]
[XMLHttpRequest: responseXML non well-formed tests]
expected: FAIL
[XMLHttpRequest: responseXML non well-formed tests 1]
expected: FAIL

View file

@ -12632,6 +12632,13 @@
}
]
],
"DOMParser-parseFromString.html": [
"38715db5d923e4f153e2c4a2679f644fe1e6d14d",
[
null,
{}
]
],
"DOMParser.html": [
"f386a3e0191af2c70dcb05790ce7db15dd5ccbf1",
[

View file

@ -0,0 +1,2 @@
[DOMParser-parseFromString.html]
prefs: ["dom.servoparser.async_html_tokenizer.enabled:true"]

View file

@ -0,0 +1,15 @@
<!doctype html>
<head>
<title>Verify that parseFromString does not panic</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<iframe src="missing"></iframe>
<script>
test(() => {
{
const parser = new DOMParser();
const doc = parser.parseFromString("", "text/html");
assert_equals(doc.URL, document.URL);
}
});
</script>