aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/window.rs
diff options
context:
space:
mode:
Diffstat (limited to 'components/script/dom/window.rs')
-rw-r--r--components/script/dom/window.rs10
1 files changed, 9 insertions, 1 deletions
diff --git a/components/script/dom/window.rs b/components/script/dom/window.rs
index 208d7f1d87e..c1a6ba0c4c4 100644
--- a/components/script/dom/window.rs
+++ b/components/script/dom/window.rs
@@ -33,7 +33,7 @@ use crate::dom::cssstyledeclaration::{CSSModificationAccess, CSSStyleDeclaration
use crate::dom::customelementregistry::CustomElementRegistry;
use crate::dom::document::{AnimationFrameCallback, Document};
use crate::dom::element::Element;
-use crate::dom::event::Event;
+use crate::dom::event::{Event, EventStatus};
use crate::dom::eventtarget::EventTarget;
use crate::dom::globalscope::GlobalScope;
use crate::dom::hashchangeevent::HashChangeEvent;
@@ -528,6 +528,14 @@ impl Window {
pub fn get_event_loop_waker(&self) -> Option<Box<dyn EventLoopWaker>> {
self.event_loop_waker.as_ref().map(|w| (*w).clone_box())
}
+
+ // see note at https://dom.spec.whatwg.org/#concept-event-dispatch step 2
+ pub fn dispatch_event_with_target_override(&self, event: &Event) -> EventStatus {
+ if self.has_document() {
+ assert!(self.Document().can_invoke_script());
+ }
+ event.dispatch(self.upcast(), true)
+ }
}
// https://html.spec.whatwg.org/multipage/#atob