mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
parent
821797d6f7
commit
6c8bfdb774
7 changed files with 45 additions and 17 deletions
|
@ -18,6 +18,7 @@ use dom::bindings::str::DOMString;
|
|||
use dom::document::Document;
|
||||
use dom::element::{AttributeMutation, Element, ElementCreator};
|
||||
use dom::event::{Event, EventBubbles, EventCancelable};
|
||||
use dom::eventdispatcher::EventStatus;
|
||||
use dom::htmlelement::HTMLElement;
|
||||
use dom::node::{ChildrenMutation, CloneChildrenFlag, Node};
|
||||
use dom::node::{document_from_node, window_from_node};
|
||||
|
@ -444,7 +445,7 @@ impl HTMLScriptElement {
|
|||
}
|
||||
|
||||
// TODO(#12446): beforescriptexecute.
|
||||
if !self.dispatch_before_script_execute_event() {
|
||||
if self.dispatch_before_script_execute_event() == EventStatus::Canceled {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -491,7 +492,7 @@ impl HTMLScriptElement {
|
|||
window.dom_manipulation_task_source().queue_simple_event(self.upcast(), atom!("error"), window.r());
|
||||
}
|
||||
|
||||
pub fn dispatch_before_script_execute_event(&self) -> bool {
|
||||
pub fn dispatch_before_script_execute_event(&self) -> EventStatus {
|
||||
self.dispatch_event(atom!("beforescriptexecute"),
|
||||
EventBubbles::Bubbles,
|
||||
EventCancelable::Cancelable)
|
||||
|
@ -562,7 +563,7 @@ impl HTMLScriptElement {
|
|||
fn dispatch_event(&self,
|
||||
type_: Atom,
|
||||
bubbles: EventBubbles,
|
||||
cancelable: EventCancelable) -> bool {
|
||||
cancelable: EventCancelable) -> EventStatus {
|
||||
let window = window_from_node(self);
|
||||
let window = window.r();
|
||||
let event = Event::new(GlobalRef::Window(window), type_, bubbles, cancelable);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue