Backed out changeset 6a408466ecb6 (bug 1731504) for causing bug 1739045 CLOSED TREE

This commit is contained in:
Cristian Tuns 2021-11-03 12:10:03 -04:00
Родитель b0d25cacc3
Коммит 7863a1ef75
12 изменённых файлов: 53 добавлений и 20 удалений

Просмотреть файл

@ -344,8 +344,10 @@ already_AddRefed<Event> Event::Constructor(EventTarget* aEventTarget,
}
uint16_t Event::EventPhase() const {
// Note, remember to check that this works also
// if or when Bug 235441 is fixed.
if ((mEvent->mCurrentTarget && mEvent->mCurrentTarget == mEvent->mTarget) ||
mEvent->mFlags.mInTargetPhase) {
mEvent->mFlags.InTargetPhase()) {
return Event_Binding::AT_TARGET;
}
if (mEvent->mFlags.mInCapturePhase) {

Просмотреть файл

@ -537,7 +537,7 @@ void EventTargetChainItem::HandleEventTargetChain(
}
// Target
aVisitor.mEvent->mFlags.mInTargetPhase = true;
aVisitor.mEvent->mFlags.mInBubblingPhase = true;
EventTargetChainItem& targetItem = aChain[firstCanHandleEventTargetIdx];
// Need to explicitly retarget touch targets so that initial targets get set
// properly in case nothing else retargeted touches.
@ -549,20 +549,12 @@ void EventTargetChainItem::HandleEventTargetChain(
targetItem.ForceContentDispatch())) {
targetItem.HandleEvent(aVisitor, aCd);
}
aVisitor.mEvent->mFlags.mInCapturePhase = false;
aVisitor.mEvent->mFlags.mInBubblingPhase = true;
if (!aVisitor.mEvent->PropagationStopped() &&
(!aVisitor.mEvent->mFlags.mNoContentDispatch ||
targetItem.ForceContentDispatch())) {
targetItem.HandleEvent(aVisitor, aCd);
}
if (aVisitor.mEvent->mFlags.mInSystemGroup) {
targetItem.PostHandleEvent(aVisitor);
}
aVisitor.mEvent->mFlags.mInTargetPhase = false;
// Bubble
aVisitor.mEvent->mFlags.mInCapturePhase = false;
for (uint32_t i = firstCanHandleEventTargetIdx + 1; i < chainLength; ++i) {
EventTargetChainItem& item = aChain[i];
if (item.PreHandleEventOnly()) {

Просмотреть файл

@ -59,10 +59,8 @@ function starttest() {
let events = [];
let listener = event => events.push(event);
let preventDefault = event => event.preventDefault();
// promiseNativeMouseEventAndWaitForEvent uses capturing listeners
// internally, so use capturing listeners also here.
$("testMouseEvent").addEventListener("mousedown", listener, true);
$("testMouseEvent").addEventListener("mouseup", listener, true);
$("testMouseEvent").addEventListener("mousedown", listener);
$("testMouseEvent").addEventListener("mouseup", listener);
// Clicking with modifiers may open context menu so that we should prevent to open it.
window.addEventListener("contextmenu", preventDefault, { capture: true });
for (const test of [

Просмотреть файл

@ -0,0 +1,4 @@
[MediaQueryList-extends-EventTarget-interop.html]
[capturing event listener fires before non-capturing listener at target]
expected: FAIL
bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1492446

Просмотреть файл

@ -0,0 +1,4 @@
[Event-dispatch-handlers-changed.html]
[ Dispatch additional events inside an event listener ]
expected: FAIL

Просмотреть файл

@ -0,0 +1,4 @@
[Event-dispatch-listener-order.window.html]
[Event-dispatch-listener-order]
expected: FAIL

Просмотреть файл

@ -0,0 +1,4 @@
[Event-dispatch-order-at-target.html]
[Listeners are invoked in correct order (AT_TARGET phase)]
expected: FAIL

Просмотреть файл

@ -0,0 +1,4 @@
[Event-stopPropagation-cancel-bubbling.html]
[Event-stopPropagation-cancel-bubbling]
expected: FAIL

Просмотреть файл

@ -0,0 +1,4 @@
[EventTarget-dispatchEvent.html]
[Capturing event listeners should be called before non-capturing ones]
expected: FAIL

Просмотреть файл

@ -0,0 +1,16 @@
[capturing-and-bubbling-event-listeners-across-shadow-trees.html]
[Capturing event listeners should be invoked before bubbling event listeners when an event is dispatched inside a shadow tree which passes through another shadow tree]
expected: FAIL
[Capturing event listeners should be invoked before bubbling event listeners when an event is dispatched via a slot]
expected: FAIL
[Capturing event listeners should be invoked before bubbling event listeners when an event is dispatched inside a shadow tree]
expected: FAIL
[Capturing event listeners should be invoked before bubbling event listeners when an event is dispatched inside a doubly nested shadow tree]
expected: FAIL
[Capturing event listeners should be invoked before bubbling event listeners on the target without shadow trees]
expected: FAIL

Просмотреть файл

@ -240,9 +240,7 @@ function PopupNotifications(tabbrowser, panel, iconBox, options = {}) {
this.iconBox = iconBox;
this.buttonDelay = Services.prefs.getIntPref(PREF_SECURITY_DELAY);
// panel itself has a listener in the bubble phase and this listener
// needs to be called after that, so use bubble phase here.
this.panel.addEventListener("popuphidden", this);
this.panel.addEventListener("popuphidden", this, true);
this.panel.classList.add("popup-notification-panel", "panel-no-padding");
// This listener will be attached to the chrome window whenever a notification

Просмотреть файл

@ -64,8 +64,6 @@ struct BaseEventFlags {
bool mInBubblingPhase : 1;
// If mInCapturePhase is true, the event is in capture phase or target phase.
bool mInCapturePhase : 1;
// If mInTargetPhase is true, the event is in target phase.
bool mInTargetPhase : 1;
// If mInSystemGroup is true, the event is being dispatched in system group.
bool mInSystemGroup : 1;
// If mCancelable is true, the event can be consumed. I.e., calling
@ -188,6 +186,11 @@ struct BaseEventFlags {
// listener.
bool mHadNonPrivilegedClickListeners : 1;
// If the event is being handled in target phase, returns true.
inline bool InTargetPhase() const {
return (mInBubblingPhase && mInCapturePhase);
}
/**
* Helper methods for methods of DOM Event.
*/