LibWeb: Add test when networking task is interrupted by networking task

It does fetching and uses parseFromString() DOMParser API in the fetch
callback. Following steps end up hanging before reverting
664611bae4:
1. Do fetching initiated by fetch() js call.
2. Invoke fetch callback on networking task source
3. Fetch callback does parseFromString()
4. parseFromString() invokes HTMLParser
5. HTMLLinkElement inserted into new document initiates fetching
6. Fetching callback cannot run because networking source was blocked on
   step 2.
7. HTMLParser::the_end() spins waiting for HTMLLinkElement to unblock
   load event, which will never happen because fetching callback cannot
   proceed.
This commit is contained in:
Aliaksandr Kalenik 2024-04-13 06:13:57 +02:00 committed by Andreas Kling
parent 9d69563da4
commit 69d6abc60f
Notes: sideshowbarker 2024-07-17 08:34:29 +09:00
2 changed files with 21 additions and 0 deletions

View file

@ -0,0 +1 @@
hello! hello!

View file

@ -0,0 +1,20 @@
<!DOCTYPE html>
<head>
<script src="include.js"></script>
<link href="file://does-not-exists.css" rel="stylesheet" />
</head>
<script>
asyncTest(done => {
fetch("parse-document-from-string-in-fetch-callback.html")
.then(response => {
return response.text()
})
.then(text => {
const parser = new DOMParser();
const newDoc = parser.parseFromString(text, 'text/html');
println(newDoc.body.innerHTML);
done();
});
});
</script>
<body>hello!</body>