mirror of
https://github.com/RGBCube/serenity
synced 2025-07-10 09:57:35 +00:00
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.
This commit is contained in:
parent
5291d516c0
commit
d8cfe79a20
2 changed files with 2 additions and 26 deletions
|
@ -35,8 +35,8 @@ JS::GCPtr<Layout::Node> HTMLIFrameElement::create_layout_node(NonnullRefPtr<CSS:
|
||||||
void HTMLIFrameElement::attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value)
|
void HTMLIFrameElement::attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value)
|
||||||
{
|
{
|
||||||
HTMLElement::attribute_changed(name, value);
|
HTMLElement::attribute_changed(name, value);
|
||||||
if (name == HTML::AttributeNames::src)
|
if (m_nested_browsing_context)
|
||||||
load_src(value);
|
process_the_iframe_attributes();
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/iframe-embed-object.html#the-iframe-element:the-iframe-element-6
|
// 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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void HTMLIFrameElement::load_src(DeprecatedString const& value)
|
|
||||||
{
|
|
||||||
if (!m_nested_browsing_context)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (value.is_null())
|
|
||||||
return;
|
|
||||||
|
|
||||||
auto url = document().parse_url(value);
|
|
||||||
if (!url.is_valid()) {
|
|
||||||
dbgln("iframe failed to load URL: Invalid URL: {}", value);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (url.scheme() == "file" && document().origin().scheme() != "file") {
|
|
||||||
dbgln("iframe failed to load URL: Security violation: {} may not load {}", document().url(), url);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
dbgln("Loading iframe document from {}", value);
|
|
||||||
m_nested_browsing_context->loader().load(url, FrameLoader::Type::IFrame);
|
|
||||||
}
|
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/rendering.html#attributes-for-embedded-content-and-images
|
// https://html.spec.whatwg.org/multipage/rendering.html#attributes-for-embedded-content-and-images
|
||||||
void HTMLIFrameElement::apply_presentational_hints(CSS::StyleProperties& style) const
|
void HTMLIFrameElement::apply_presentational_hints(CSS::StyleProperties& style) const
|
||||||
{
|
{
|
||||||
|
|
|
@ -39,8 +39,6 @@ private:
|
||||||
// https://html.spec.whatwg.org/multipage/iframe-embed-object.html#process-the-iframe-attributes
|
// https://html.spec.whatwg.org/multipage/iframe-embed-object.html#process-the-iframe-attributes
|
||||||
void process_the_iframe_attributes(bool initial_insertion = false);
|
void process_the_iframe_attributes(bool initial_insertion = false);
|
||||||
|
|
||||||
void load_src(DeprecatedString const&);
|
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/iframe-embed-object.html#current-navigation-was-lazy-loaded
|
// https://html.spec.whatwg.org/multipage/iframe-embed-object.html#current-navigation-was-lazy-loaded
|
||||||
bool m_current_navigation_was_lazy_loaded { false };
|
bool m_current_navigation_was_lazy_loaded { false };
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue