mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-24 02:09:28 +00:00
LibWeb: Don't use the internal window object when parsing HTML fragments
Instead, use the window object from the context element. This fixes an issue where activating event handlers during fragment parsing would try to set up callbacks using the internal window object's ESO. This caused a verify_cast crash on Google Maps, since the internal realm doesn't have an associated ESO. Perhaps it should, but in this specific case, it makes more sense for fragment parsing to fully adopt the context provided.
This commit is contained in:
@@ -3369,7 +3369,7 @@ DOM::Document& HTMLParser::document()
|
||||
|
||||
Vector<JS::Handle<DOM::Node>> HTMLParser::parse_html_fragment(DOM::Element& context_element, StringView markup)
|
||||
{
|
||||
auto temp_document = DOM::Document::create(Bindings::main_thread_internal_window_object());
|
||||
auto temp_document = DOM::Document::create(context_element.window());
|
||||
auto parser = HTMLParser::create(*temp_document, markup, "utf-8");
|
||||
parser->m_context_element = JS::make_handle(context_element);
|
||||
parser->m_parsing_fragment = true;
|
||||
|
||||
Reference in New Issue
Block a user