From 2a86bd8c919f2dc20665eb2cda5bf739aa66a153 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Mon, 28 Aug 2023 09:14:36 +0200 Subject: [PATCH] LibWeb: Fire the fail callback on SharedImageRequest when they fail This fixes an issue where failed image loads would delay the document load event forever. --- .../failed-img-should-not-delay-load-event-forever.txt | 1 + .../failed-img-should-not-delay-load-event-forever.html | 7 +++++++ Userland/Libraries/LibWeb/HTML/SharedImageRequest.cpp | 2 ++ 3 files changed, 10 insertions(+) create mode 100644 Tests/LibWeb/Text/expected/failed-img-should-not-delay-load-event-forever.txt create mode 100644 Tests/LibWeb/Text/input/failed-img-should-not-delay-load-event-forever.html diff --git a/Tests/LibWeb/Text/expected/failed-img-should-not-delay-load-event-forever.txt b/Tests/LibWeb/Text/expected/failed-img-should-not-delay-load-event-forever.txt new file mode 100644 index 00000000000..5df6241a8b5 --- /dev/null +++ b/Tests/LibWeb/Text/expected/failed-img-should-not-delay-load-event-forever.txt @@ -0,0 +1 @@ + PASS diff --git a/Tests/LibWeb/Text/input/failed-img-should-not-delay-load-event-forever.html b/Tests/LibWeb/Text/input/failed-img-should-not-delay-load-event-forever.html new file mode 100644 index 00000000000..b67283b3a4a --- /dev/null +++ b/Tests/LibWeb/Text/input/failed-img-should-not-delay-load-event-forever.html @@ -0,0 +1,7 @@ + + + diff --git a/Userland/Libraries/LibWeb/HTML/SharedImageRequest.cpp b/Userland/Libraries/LibWeb/HTML/SharedImageRequest.cpp index 46b4e1d3d72..3abb5c7b3bf 100644 --- a/Userland/Libraries/LibWeb/HTML/SharedImageRequest.cpp +++ b/Userland/Libraries/LibWeb/HTML/SharedImageRequest.cpp @@ -84,6 +84,8 @@ void SharedImageRequest::fetch_image(JS::Realm& realm, JS::NonnullGCPtrbody()) response->body()->fully_read(realm, move(process_body), move(process_body_error), JS::NonnullGCPtr { realm.global_object() }).release_value_but_fixme_should_propagate_errors(); + else + handle_failed_fetch(); }; m_state = State::Fetching;