LibWeb: Fire iframe load event for frames with badly encoded XML

When loading an XML resource into an iframe and the resource fails to
decode (e.g due to invalid UTF-8), we must still fire a load event.

This fixes the regression in subtest 69 of Acid3.
This commit is contained in:
Andreas Kling 2024-04-18 15:28:33 +02:00 committed by Alexander Kalenik
parent bad86ca6b4
commit fa43321938
Notes: sideshowbarker 2024-07-17 23:00:03 +09:00
3 changed files with 13 additions and 0 deletions

View File

@ -0,0 +1,10 @@
<iframe id="i1"></iframe>
<script src="../include.js"></script>
<script>
test(() => {
i1.src = "data:application/xml;charset=utf-8;base64,vwo=";
i1.onload = function() {
println("OK");
}
});
</script>

View File

@ -219,12 +219,14 @@ static WebIDL::ExceptionOr<JS::NonnullGCPtr<DOM::Document>> load_xml_document(HT
if (!decoder->validate(data)) {
// FIXME: Insert error message into the document.
dbgln("XML Document contains improperly-encoded characters");
document->completely_finish_loading();
return;
}
auto source = decoder->to_utf8(data);
if (source.is_error()) {
// FIXME: Insert error message into the document.
dbgln("Failed to decode XML document: {}", source.error());
document->completely_finish_loading();
return;
}
XML::Parser parser(source.value(), { .resolve_external_resource = resolve_xml_resource });