LibWeb: Set iframe sandbox flags before child navigable creation

The initial about:blank document inherits sandbox flags when the
child navigable is created. Parse the iframe sandbox attribute first
so the initial child document gets the correct sandbox state.

Fixed in the HTML spec with:

https://github.com/whatwg/html/commit/3fd7f35
This commit is contained in:
Shannon Booth
2026-04-12 14:04:20 +02:00
committed by Shannon Booth
parent 04211d5a51
commit 290db9d690
Notes: github-actions[bot] 2026-04-14 21:02:38 +00:00

View File

@@ -109,15 +109,14 @@ void HTMLIFrameElement::post_connection()
if (!document.browsing_context() || !document.is_fully_active())
return;
// The iframe HTML element post-connection steps, given insertedNode, are:
// 1. Create a new child navigable for insertedNode.
create_new_child_navigable();
// 2. If insertedNode has a sandbox attribute, then parse the sandboxing directive given the attribute's
// 1. If insertedNode has a sandbox attribute, then parse the sandboxing directive given the attribute's
// value and insertedNode's iframe sandboxing flag set.
if (auto sandbox = attribute(AttributeNames::sandbox); sandbox.has_value())
m_iframe_sandboxing_flag_set = parse_a_sandboxing_directive(sandbox.value());
// 2. Create a new child navigable for insertedNode.
create_new_child_navigable();
// 3. Process the iframe attributes for insertedNode, with initialInsertion set to true.
process_the_iframe_attributes(InitialInsertion::Yes);
}