summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/Loader
diff options
context:
space:
mode:
authorMacDue <macdue@dueutil.tech>2022-10-02 17:55:31 +0100
committerLinus Groh <mail@linusgroh.de>2022-10-02 19:58:26 +0100
commite852aff9e37ef43aa002e54c36cfbc10cb37e7d9 (patch)
tree9eee300c5d0757ae8544e94477cac82ca03713e1 /Userland/Libraries/LibWeb/Loader
parent39f0eeae290bb8ea6292ecf4adc849a8484834f2 (diff)
downloadserenity-e852aff9e37ef43aa002e54c36cfbc10cb37e7d9.zip
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
Diffstat (limited to 'Userland/Libraries/LibWeb/Loader')
-rw-r--r--Userland/Libraries/LibWeb/Loader/FrameLoader.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/Userland/Libraries/LibWeb/Loader/FrameLoader.cpp b/Userland/Libraries/LibWeb/Loader/FrameLoader.cpp
index dd1f74a67e..efe839baf1 100644
--- a/Userland/Libraries/LibWeb/Loader/FrameLoader.cpp
+++ b/Userland/Libraries/LibWeb/Loader/FrameLoader.cpp
@@ -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";