mirror of
https://github.com/servo/servo
synced 2026-04-26 17:45:19 +02:00
script: inline dispatch_load_event and dispatch_error_event (#43285)
fixes #43280 This PR in lines the dispatch_load_event and dispatch_error_event wrappers directly into their call sites and removes the unused function definitions Signed-off-by: SharanRP <z8903830@gmail.com>
This commit is contained in:
@@ -1009,7 +1009,12 @@ impl HTMLScriptElement {
|
||||
let script = match result {
|
||||
// Step 4. If el's result is null, then fire an event named error at el, and return.
|
||||
Err(_) => {
|
||||
self.dispatch_error_event(can_gc);
|
||||
self.dispatch_event(
|
||||
atom!("error"),
|
||||
EventBubbles::DoesNotBubble,
|
||||
EventCancelable::NotCancelable,
|
||||
can_gc,
|
||||
);
|
||||
return;
|
||||
},
|
||||
|
||||
@@ -1078,7 +1083,12 @@ impl HTMLScriptElement {
|
||||
|
||||
// Step 8. If el's from an external file is true, then fire an event named load at el.
|
||||
if self.from_an_external_file.get() {
|
||||
self.dispatch_load_event(can_gc);
|
||||
self.dispatch_event(
|
||||
atom!("load"),
|
||||
EventBubbles::DoesNotBubble,
|
||||
EventCancelable::NotCancelable,
|
||||
can_gc,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1089,24 +1099,6 @@ impl HTMLScriptElement {
|
||||
.queue_simple_event(self.upcast(), atom!("error"));
|
||||
}
|
||||
|
||||
pub(crate) fn dispatch_load_event(&self, can_gc: CanGc) {
|
||||
self.dispatch_event(
|
||||
atom!("load"),
|
||||
EventBubbles::DoesNotBubble,
|
||||
EventCancelable::NotCancelable,
|
||||
can_gc,
|
||||
);
|
||||
}
|
||||
|
||||
pub(crate) fn dispatch_error_event(&self, can_gc: CanGc) {
|
||||
self.dispatch_event(
|
||||
atom!("error"),
|
||||
EventBubbles::DoesNotBubble,
|
||||
EventCancelable::NotCancelable,
|
||||
can_gc,
|
||||
);
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#prepare-a-script Step 7.
|
||||
pub(crate) fn get_script_type(&self) -> Option<ScriptType> {
|
||||
let element = self.upcast::<Element>();
|
||||
|
||||
Reference in New Issue
Block a user