Bug 1119074 - If we're stopping event propagation from XUL popups, also stop them from crossing process boundaries r=smaug,felipe

This commit is contained in:
George Wright 2015-05-25 16:54:13 -04:00
parent dd0ba5a2e6
commit 4e327f57b4
4 changed files with 15 additions and 1 deletions

View File

@ -481,6 +481,13 @@ Event::StopImmediatePropagation()
return NS_OK;
}
NS_IMETHODIMP
Event::StopCrossProcessForwarding()
{
mEvent->mFlags.mNoCrossProcessBoundaryForwarding = true;
return NS_OK;
}
NS_IMETHODIMP
Event::GetIsTrusted(bool* aIsTrusted)
{

View File

@ -309,6 +309,7 @@ private:
NS_IMETHOD GetCancelable(bool* aCancelable) override { return _to GetCancelable(aCancelable); } \
NS_IMETHOD GetTimeStamp(DOMTimeStamp* aTimeStamp) override { return _to GetTimeStamp(aTimeStamp); } \
NS_IMETHOD StopPropagation(void) override { return _to StopPropagation(); } \
NS_IMETHOD StopCrossProcessForwarding(void) override { return _to StopCrossProcessForwarding(); } \
NS_IMETHOD PreventDefault(void) override { return _to PreventDefault(); } \
NS_IMETHOD InitEvent(const nsAString& eventTypeArg, bool canBubbleArg, bool cancelableArg) override { return _to InitEvent(eventTypeArg, canBubbleArg, cancelableArg); } \
NS_IMETHOD GetDefaultPrevented(bool* aDefaultPrevented) override { return _to GetDefaultPrevented(aDefaultPrevented); } \

View File

@ -40,7 +40,7 @@ class EventTarget;
* http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html
*/
[builtinclass, uuid(02d54f52-a1f5-4ad2-b560-36f14012935e)]
[builtinclass, uuid(63857daf-c084-4ea6-a8b9-6812e3176991)]
interface nsIDOMEvent : nsISupports
{
// PhaseType
@ -213,6 +213,7 @@ interface nsIDOMEvent : nsISupports
[notxpcom] boolean Deserialize(in ConstIPCMessagePtr aMsg, out voidPtr aIter);
[noscript,notxpcom] void SetOwner(in EventTargetPtr aOwner);
[notxpcom] DOMEventPtr InternalDOMEvent();
[noscript] void stopCrossProcessForwarding();
};
%{C++

View File

@ -2178,6 +2178,7 @@ nsXULPopupManager::HandleKeyboardEventWithKeyCode(
if (keyCode == nsIDOMKeyEvent::DOM_VK_ESCAPE) {
HidePopup(aTopVisibleMenuItem->Content(), false, false, false, true);
aKeyEvent->StopPropagation();
aKeyEvent->StopCrossProcessForwarding();
aKeyEvent->PreventDefault();
}
return true;
@ -2249,6 +2250,7 @@ nsXULPopupManager::HandleKeyboardEventWithKeyCode(
if (consume) {
aKeyEvent->StopPropagation();
aKeyEvent->StopCrossProcessForwarding();
aKeyEvent->PreventDefault();
}
return true;
@ -2449,6 +2451,7 @@ nsXULPopupManager::KeyUp(nsIDOMKeyEvent* aKeyEvent)
}
aKeyEvent->StopPropagation();
aKeyEvent->StopCrossProcessForwarding();
aKeyEvent->PreventDefault();
return NS_OK; // I am consuming event
@ -2507,6 +2510,7 @@ nsXULPopupManager::KeyDown(nsIDOMKeyEvent* aKeyEvent)
// Since a menu was open, stop propagation of the event to keep other event
// listeners from becoming confused.
aKeyEvent->StopPropagation();
aKeyEvent->StopCrossProcessForwarding();
return NS_OK;
}
@ -2528,6 +2532,7 @@ nsXULPopupManager::KeyPress(nsIDOMKeyEvent* aKeyEvent)
HandleShortcutNavigation(keyEvent, nullptr);
if (consume) {
aKeyEvent->StopPropagation();
aKeyEvent->StopCrossProcessForwarding();
aKeyEvent->PreventDefault();
}