summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2022-09-19 12:33:05 +0200
committerAndreas Kling <kling@serenityos.org>2022-09-20 10:32:12 +0200
commit954da8fde579b6111ffcc91884f9766a9a1ad634 (patch)
tree79edf57c1416fa02b0efaa6bfcb00e8dfda6bdbf /Userland/Libraries/LibWeb
parent8ead228202397e79802a35b9b1b6c7ad4567bd96 (diff)
downloadserenity-954da8fde579b6111ffcc91884f9766a9a1ad634.zip
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.
Diffstat (limited to 'Userland/Libraries/LibWeb')
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.cpp
index ef3f3e2a6c..5d5d0eae12 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.cpp
+++ b/Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.cpp
@@ -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