1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 15:27:35 +00:00

LibWeb: Only create iframe nested context if iframe document has context

We had glossed over a condition in the spec that said we should only run
the nested context creation steps when the iframe's own containing
document has a browsing context.
This commit is contained in:
Andreas Kling 2022-09-19 12:33:05 +02:00
parent 8ead228202
commit 954da8fde5

View file

@ -38,9 +38,8 @@ void HTMLIFrameElement::inserted()
{ {
HTMLElement::inserted(); HTMLElement::inserted();
if (!is_connected()) // When an iframe element element is inserted into a document whose browsing context is non-null, the user agent must run these steps:
return; if (document().browsing_context()) {
// 1. Create a new nested browsing context for element. // 1. Create a new nested browsing context for element.
create_new_nested_browsing_context(); create_new_nested_browsing_context();
@ -48,6 +47,7 @@ void HTMLIFrameElement::inserted()
// 3. Process the iframe attributes for element, with initialInsertion set to true. // 3. Process the iframe attributes for element, with initialInsertion set to true.
load_src(attribute(HTML::AttributeNames::src)); load_src(attribute(HTML::AttributeNames::src));
}
} }
// https://html.spec.whatwg.org/multipage/iframe-embed-object.html#the-iframe-element:the-iframe-element-7 // https://html.spec.whatwg.org/multipage/iframe-embed-object.html#the-iframe-element:the-iframe-element-7