aboutsummaryrefslogtreecommitdiffstats
path: root/components/script
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2016-09-12 13:22:18 -0500
committerGitHub <noreply@github.com>2016-09-12 13:22:18 -0500
commitbb53da69578887befae195b18255967cc7f3fc59 (patch)
treef228ee7380013f32d2e980d17ce3f24358fb3f2c /components/script
parent35ea9c506378255e643668ead9e2d0a5ef4bb768 (diff)
parent3eaf1c1b899f1626fc5672eb677d2ac148533790 (diff)
downloadservo-bb53da69578887befae195b18255967cc7f3fc59.tar.gz
servo-bb53da69578887befae195b18255967cc7f3fc59.zip
Auto merge of #13245 - servo:reset-stop-propagation, r=nox
Correct an unsound optimization in event dispatch. <!-- Reviewable:start --> This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/13245) <!-- Reviewable:end -->
Diffstat (limited to 'components/script')
-rw-r--r--components/script/dom/eventdispatcher.rs14
1 files changed, 9 insertions, 5 deletions
diff --git a/components/script/dom/eventdispatcher.rs b/components/script/dom/eventdispatcher.rs
index 01973e7c916..e9525f17604 100644
--- a/components/script/dom/eventdispatcher.rs
+++ b/components/script/dom/eventdispatcher.rs
@@ -112,19 +112,23 @@ pub fn dispatch_event(target: &EventTarget,
assert_eq!(event.phase(), EventPhase::None);
assert!(event.GetCurrentTarget().is_none());
+ // Step 1.
+ event.mark_as_dispatching();
+
// Step 2.
event.set_target(target_override.unwrap_or(target));
if event.stop_propagation() {
// If the event's stop propagation flag is set, we can skip everything because
- // it prevents the calls of the invoke algorithm in the spec and we asserted
- // at the beginning that steps 10-12 don't need to be executed.
+ // it prevents the calls of the invoke algorithm in the spec.
+
+ // Step 10-12.
+ event.clear_dispatching_flags();
+
+ // Step 14.
return !event.DefaultPrevented();
}
- // Step 1. Postponed here for the reason stated above.
- event.mark_as_dispatching();
-
// Step 3. The "invoke" algorithm is only used on `target` separately,
// so we don't put it in the path.
rooted_vec!(let mut event_path);