mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 07:38:10 +00:00
LibWeb: Use the task queue to fire "error" events on scripts
This commit is contained in:
parent
33f67e4c0f
commit
5356de1c58
1 changed files with 7 additions and 5 deletions
|
@ -243,11 +243,12 @@ void HTMLScriptElement::prepare_script()
|
||||||
if (has_attribute(HTML::AttributeNames::src)) {
|
if (has_attribute(HTML::AttributeNames::src)) {
|
||||||
// 1. Let src be the value of the element's src attribute.
|
// 1. Let src be the value of the element's src attribute.
|
||||||
auto src = attribute(HTML::AttributeNames::src);
|
auto src = attribute(HTML::AttributeNames::src);
|
||||||
// FIXME: 2. If src is the empty string, queue a task to fire an event named error at the element, and return.
|
// 2. If src is the empty string, queue a task to fire an event named error at the element, and return.
|
||||||
if (src.is_empty()) {
|
if (src.is_empty()) {
|
||||||
dbgln("HTMLScriptElement: Refusing to run script because the src attribute is empty.");
|
dbgln("HTMLScriptElement: Refusing to run script because the src attribute is empty.");
|
||||||
// FIXME: Queue a task to do this.
|
queue_an_element_task(HTML::Task::Source::Unspecified, [this] {
|
||||||
dispatch_event(DOM::Event::create(HTML::EventNames::error));
|
dispatch_event(DOM::Event::create(HTML::EventNames::error));
|
||||||
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// 3. Set the element's from an external file flag.
|
// 3. Set the element's from an external file flag.
|
||||||
|
@ -258,8 +259,9 @@ void HTMLScriptElement::prepare_script()
|
||||||
// 5. If the previous step failed, queue a task to fire an event named error at the element, and return. Otherwise, let url be the resulting URL record.
|
// 5. If the previous step failed, queue a task to fire an event named error at the element, and return. Otherwise, let url be the resulting URL record.
|
||||||
if (!url.is_valid()) {
|
if (!url.is_valid()) {
|
||||||
dbgln("HTMLScriptElement: Refusing to run script because the src URL '{}' is invalid.", url);
|
dbgln("HTMLScriptElement: Refusing to run script because the src URL '{}' is invalid.", url);
|
||||||
// FIXME: Queue a task to do this.
|
queue_an_element_task(HTML::Task::Source::Unspecified, [this] {
|
||||||
dispatch_event(DOM::Event::create(HTML::EventNames::error));
|
dispatch_event(DOM::Event::create(HTML::EventNames::error));
|
||||||
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue