Short-circuit initFooEvent while dispatching events.

This commit is contained in:
Josh Matthews 2014-11-12 14:23:52 -05:00
parent 642a3592c7
commit c23edf6f5a
5 changed files with 23 additions and 4 deletions

View file

@ -65,8 +65,12 @@ impl<'a> CustomEventMethods for JSRef<'a, CustomEvent> {
can_bubble: bool,
cancelable: bool,
detail: JSVal) {
self.detail.set(detail);
let event: JSRef<Event> = EventCast::from_ref(self);
if event.dispatching() {
return;
}
self.detail.set(detail);
event.InitEvent(type_, can_bubble, cancelable);
}
}