Skip to content

Commit d8cfe79

Browse files
kalenikaliaksandrawesomekling
authored andcommitted
LibWeb: Call process_the_iframe_attributes if iframe attribute changed
Replaces `load_src()` with `process_the_iframe_attributes()`. Both load document of iframe but the latter is defined in spec.
1 parent 5291d51 commit d8cfe79

File tree

2 files changed

+2
-26
lines changed

2 files changed

+2
-26
lines changed

Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.cpp

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ JS::GCPtr<Layout::Node> HTMLIFrameElement::create_layout_node(NonnullRefPtr<CSS:
3535
void HTMLIFrameElement::attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value)
3636
{
3737
HTMLElement::attribute_changed(name, value);
38-
if (name == HTML::AttributeNames::src)
39-
load_src(value);
38+
if (m_nested_browsing_context)
39+
process_the_iframe_attributes();
4040
}
4141

4242
// https://html.spec.whatwg.org/multipage/iframe-embed-object.html#the-iframe-element:the-iframe-element-6
@@ -109,28 +109,6 @@ void HTMLIFrameElement::removed_from(DOM::Node* node)
109109
}
110110
}
111111

112-
void HTMLIFrameElement::load_src(DeprecatedString const& value)
113-
{
114-
if (!m_nested_browsing_context)
115-
return;
116-
117-
if (value.is_null())
118-
return;
119-
120-
auto url = document().parse_url(value);
121-
if (!url.is_valid()) {
122-
dbgln("iframe failed to load URL: Invalid URL: {}", value);
123-
return;
124-
}
125-
if (url.scheme() == "file" && document().origin().scheme() != "file") {
126-
dbgln("iframe failed to load URL: Security violation: {} may not load {}", document().url(), url);
127-
return;
128-
}
129-
130-
dbgln("Loading iframe document from {}", value);
131-
m_nested_browsing_context->loader().load(url, FrameLoader::Type::IFrame);
132-
}
133-
134112
// https://html.spec.whatwg.org/multipage/rendering.html#attributes-for-embedded-content-and-images
135113
void HTMLIFrameElement::apply_presentational_hints(CSS::StyleProperties& style) const
136114
{

Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,6 @@ class HTMLIFrameElement final : public NavigableContainer {
3939
// https://html.spec.whatwg.org/multipage/iframe-embed-object.html#process-the-iframe-attributes
4040
void process_the_iframe_attributes(bool initial_insertion = false);
4141

42-
void load_src(DeprecatedString const&);
43-
4442
// https://html.spec.whatwg.org/multipage/iframe-embed-object.html#current-navigation-was-lazy-loaded
4543
bool m_current_navigation_was_lazy_loaded { false };
4644
};

0 commit comments

Comments
 (0)