Skip to content

Commit

Permalink
LibWeb: Only create iframe nested context if iframe document has context
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
awesomekling committed Sep 20, 2022
1 parent 8ead228 commit 954da8f
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,16 @@ void HTMLIFrameElement::inserted()
{
HTMLElement::inserted();

if (!is_connected())
return;

// 1. Create a new nested browsing context for element.
create_new_nested_browsing_context();
// When an iframe element element is inserted into a document whose browsing context is non-null, the user agent must run these steps:
if (document().browsing_context()) {
// 1. Create a new nested browsing context for element.
create_new_nested_browsing_context();

// FIXME: 2. If element has a sandbox attribute, then parse the sandboxing directive given the attribute's value and element's iframe sandboxing flag set.
// FIXME: 2. If element has a sandbox attribute, then parse the sandboxing directive given the attribute's value and element's iframe sandboxing flag set.

// 3. Process the iframe attributes for element, with initialInsertion set to true.
load_src(attribute(HTML::AttributeNames::src));
// 3. Process the iframe attributes for element, with initialInsertion set to true.
load_src(attribute(HTML::AttributeNames::src));
}
}

// https://html.spec.whatwg.org/multipage/iframe-embed-object.html#the-iframe-element:the-iframe-element-7
Expand Down

0 comments on commit 954da8f

Please sign in to comment.