1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-20 14:55:08 +00:00

LibWeb: Fix crash when loading a HTML string that contains an iframe

The HTMLIFrameElement does not create the nested browsing context on
insertion if the document does not have browsing context, which is not
set unless it's the active document.

Previously, in FrameLoader the document was not set as active until
after parsing, which led to iframes without nested browsing contexts,
and crashes.

Fixes #14207
This commit is contained in:
MacDue 2022-10-02 17:55:31 +01:00 committed by Linus Groh
parent 39f0eeae29
commit e852aff9e3

View file

@ -317,10 +317,10 @@ void FrameLoader::load_html(StringView html, const AK::URL& url)
DOM::Document::Type::HTML,
"text/html",
move(navigation_params));
browsing_context().set_active_document(document);
auto parser = HTML::HTMLParser::create(document, html, "utf-8");
parser->run(url);
browsing_context().set_active_document(parser->document());
}
static String s_error_page_url = "file:///res/html/error.html";