mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-25 17:10:23 +00:00
LibWeb: Return empty string if object element data
URL is invalid
This commit is contained in:
parent
4f7a4d9c57
commit
c61262684b
Notes:
github-actions[bot]
2024-08-15 07:45:28 +00:00
Author: https://github.com/tcl3 Commit: https://github.com/LadybirdBrowser/ladybird/commit/c61262684b5 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1080
3 changed files with 7 additions and 2 deletions
|
@ -1 +1,2 @@
|
|||
img.currentSrc default value: ''
|
||||
object.data default value: ''
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
test(() => {
|
||||
const elementList = [
|
||||
{ "img": "currentSrc" },
|
||||
{ "object": "data" },
|
||||
];
|
||||
for (const elementDescriptor of elementList) {
|
||||
[elementName, propertyName] = Object.entries(elementDescriptor)[0];
|
||||
|
|
|
@ -77,8 +77,11 @@ void HTMLObjectElement::form_associated_element_was_removed(DOM::Node*)
|
|||
// https://html.spec.whatwg.org/multipage/iframe-embed-object.html#attr-object-data
|
||||
String HTMLObjectElement::data() const
|
||||
{
|
||||
auto data = get_attribute_value(HTML::AttributeNames::data);
|
||||
return MUST(document().parse_url(data).to_string());
|
||||
auto data = get_attribute(HTML::AttributeNames::data);
|
||||
if (!data.has_value())
|
||||
return {};
|
||||
|
||||
return MUST(document().parse_url(*data).to_string());
|
||||
}
|
||||
|
||||
JS::GCPtr<Layout::Node> HTMLObjectElement::create_layout_node(NonnullRefPtr<CSS::StyleProperties> style)
|
||||
|
|
Loading…
Reference in a new issue