From 69d6abc60f8d55a34eb8642ad5b7930146ed46dc Mon Sep 17 00:00:00 2001 From: Aliaksandr Kalenik Date: Sat, 13 Apr 2024 06:13:57 +0200 Subject: [PATCH] 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 664611bae41a20d3bf740da12fdf19322f6574f1: 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. --- ...document-from-string-in-fetch-callback.txt | 1 + ...ocument-from-string-in-fetch-callback.html | 20 +++++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 Tests/LibWeb/Text/expected/parse-document-from-string-in-fetch-callback.txt create mode 100644 Tests/LibWeb/Text/input/parse-document-from-string-in-fetch-callback.html diff --git a/Tests/LibWeb/Text/expected/parse-document-from-string-in-fetch-callback.txt b/Tests/LibWeb/Text/expected/parse-document-from-string-in-fetch-callback.txt new file mode 100644 index 00000000000..1a44ce30a74 --- /dev/null +++ b/Tests/LibWeb/Text/expected/parse-document-from-string-in-fetch-callback.txt @@ -0,0 +1 @@ +hello! hello! diff --git a/Tests/LibWeb/Text/input/parse-document-from-string-in-fetch-callback.html b/Tests/LibWeb/Text/input/parse-document-from-string-in-fetch-callback.html new file mode 100644 index 00000000000..dabf6263529 --- /dev/null +++ b/Tests/LibWeb/Text/input/parse-document-from-string-in-fetch-callback.html @@ -0,0 +1,20 @@ + + + + + + +hello!