LibWeb/HTML: Use DOM's post-connection steps for iframe elements

See: c8ec987d1
This commit is contained in:
Shannon Booth 2024-12-15 02:59:23 +13:00 committed by Tim Flynn
parent 0a90143420
commit 18dddaa742
Notes: github-actions[bot] 2024-12-14 20:07:33 +00:00
4 changed files with 105 additions and 13 deletions

View file

@ -62,28 +62,22 @@ void HTMLIFrameElement::attribute_changed(FlyString const& name, Optional<String
}
}
// https://html.spec.whatwg.org/multipage/iframe-embed-object.html#the-iframe-element:the-iframe-element-6
void HTMLIFrameElement::inserted()
// https://html.spec.whatwg.org/multipage/iframe-embed-object.html#the-iframe-element:html-element-post-connection-steps
void HTMLIFrameElement::post_connection()
{
HTMLElement::inserted();
// The iframe HTML element insertion steps, given insertedNode, are:
// 1. If insertedNode's shadow-including root's browsing context is null, then return.
if (!is<DOM::Document>(shadow_including_root()))
return;
DOM::Document& document = verify_cast<DOM::Document>(shadow_including_root());
// NOTE: The check for "not fully active" is to prevent a crash on the dom/nodes/node-appendchild-crash.html WPT test.
if (!document.browsing_context() || !document.is_fully_active())
return;
// 2. Create a new child navigable for insertedNode.
// The iframe HTML element post-connection steps, given insertedNode, are:
// 1. Create a new child navigable for insertedNode.
MUST(create_new_child_navigable(GC::create_function(realm().heap(), [this] {
// FIXME: 3. If insertedNode has a sandbox attribute, then parse the sandboxing directive given the attribute's
// FIXME: 2. If insertedNode has a sandbox attribute, then parse the sandboxing directive given the attribute's
// value and insertedNode's iframe sandboxing flag set.
// 4. Process the iframe attributes for insertedNode, with initialInsertion set to true.
// 3. Process the iframe attributes for insertedNode, with initialInsertion set to true.
process_the_iframe_attributes(true);
set_content_navigable_initialized();
})));