Backed out changeset 9c3f1b715943 (bug 862519) for multiple mochitest failures.
authorRyan VanderMeulen <ryanvm@gmail.com>
Tue, 18 Mar 2014 13:00:32 -0400
changeset 174157 57a814e48f5fc3d78ed5c7c9ca8a5c5ac58fc1d7
parent 174156 683b27fa18123977f7874281525e5ead0d496272
child 174158 df75761307b6330ad14f68edbc15de3b8d7e606f
push id26443
push userkwierso@gmail.com
push dateTue, 18 Mar 2014 21:15:18 +0000
treeherdermozilla-central@df75761307b6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs862519
milestone31.0a1
backs out9c3f1b7159433ee310d77ba2742228ebaef58fb4
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backed out changeset 9c3f1b715943 (bug 862519) for multiple mochitest failures. CLOSED TREE
browser/base/content/browser.js
dom/ipc/PBrowser.ipdl
dom/ipc/TabChild.cpp
dom/ipc/TabParent.cpp
dom/ipc/TabParent.h
dom/xbl/nsXBLService.cpp
dom/xbl/nsXBLWindowKeyHandler.cpp
dom/xbl/nsXBLWindowKeyHandler.h
widget/BasicEvents.h
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -1181,16 +1181,23 @@ var gBrowserInit = {
       Cu.reportError("Could not end startup crash tracking: " + ex);
     }
 
     if (typeof WindowsPrefSync !== 'undefined') {
       // Pulls in Metro controlled prefs and pushes out Desktop controlled prefs
       WindowsPrefSync.init();
     }
 
+    if (gMultiProcessBrowser) {
+      // Bug 862519 - Backspace doesn't work in electrolysis builds.
+      // We bypass the problem by disabling the backspace-to-go-back command.
+      document.getElementById("cmd_handleBackspace").setAttribute("disabled", true);
+      document.getElementById("key_delete").setAttribute("disabled", true);
+    }
+
     SessionStore.promiseInitialized.then(() => {
       // Bail out if the window has been closed in the meantime.
       if (window.closed) {
         return;
       }
 
       // Enable the Restore Last Session command if needed
       RestoreLastSessionObserver.init();
--- a/dom/ipc/PBrowser.ipdl
+++ b/dom/ipc/PBrowser.ipdl
@@ -329,18 +329,16 @@ parent:
      * The zoom controller code lives on the parent side and so this allows it to
      * have up-to-date zoom constraints.
      */
     UpdateZoomConstraints(uint32_t aPresShellId, ViewID aViewId, bool aIsRoot,
                           ZoomConstraints aConstraints);
 
     __delete__();
 
-    ReplyKeyEvent(WidgetKeyboardEvent event);
-
 child:
     /**
      * Notify the remote browser that it has been Show()n on this
      * side, with the given |visibleRect|.  This message is expected
      * to trigger creation of the remote browser's "widget".
      *
      * |Show()| and |Move()| take IntSizes rather than Rects because
      * content processes always render to a virtual <0, 0> top-left
--- a/dom/ipc/TabChild.cpp
+++ b/dom/ipc/TabChild.cpp
@@ -1927,20 +1927,16 @@ TabChild::RecvRealKeyEvent(const WidgetK
 
   WidgetKeyboardEvent localEvent(event);
   nsEventStatus status = DispatchWidgetEvent(localEvent);
 
   if (event.message == NS_KEY_DOWN) {
     mIgnoreKeyPressEvent = status == nsEventStatus_eConsumeNoDefault;
   }
 
-  if (localEvent.mFlags.mWantReplyFromContentProcess) {
-    SendReplyKeyEvent(localEvent);
-  }
-
   return true;
 }
 
 bool
 TabChild::RecvKeyEvent(const nsString& aType,
                        const int32_t& aKeyCode,
                        const int32_t& aCharCode,
                        const int32_t& aModifiers,
--- a/dom/ipc/TabParent.cpp
+++ b/dom/ipc/TabParent.cpp
@@ -1187,38 +1187,16 @@ TabParent::GetChildProcessOffset()
   nsPoint pt = nsLayoutUtils::GetEventCoordinatesRelativeTo(widget,
                                                             nsIntPoint(0, 0),
                                                             targetFrame);
 
   return LayoutDeviceIntPoint::ToUntyped(LayoutDeviceIntPoint::FromAppUnitsToNearest(
            pt, targetFrame->PresContext()->AppUnitsPerDevPixel()));
 }
 
-bool
-TabParent::RecvReplyKeyEvent(const WidgetKeyboardEvent& event)
-{
-  NS_ENSURE_TRUE(mFrameElement, true);
-
-  WidgetKeyboardEvent localEvent(event);
-  // Set mNoCrossProcessBoundaryForwarding to avoid this event from
-  // being infinitely redispatched and forwarded to the child again.
-  localEvent.mFlags.mNoCrossProcessBoundaryForwarding = true;
-
-  // Here we convert the WidgetEvent that we received to an nsIDOMEvent
-  // to be able to dispatch it to the <browser> element as the target element.
-  nsIDocument* doc = mFrameElement->OwnerDoc();
-  nsIPresShell* presShell = doc->GetShell();
-  NS_ENSURE_TRUE(presShell, true);
-  nsPresContext* presContext = presShell->GetPresContext();
-  NS_ENSURE_TRUE(presContext, true);
-
-  EventDispatcher::Dispatch(mFrameElement, presContext, &localEvent);
-  return true;
-}
-
 /**
  * Try to answer query event using cached text.
  *
  * For NS_QUERY_SELECTED_TEXT, fail if the cache doesn't contain the whole
  *  selected range. (This shouldn't happen because PuppetWidget should have
  *  already sent the whole selection.)
  *
  * For NS_QUERY_TEXT_CONTENT, fail only if the cache doesn't overlap with
--- a/dom/ipc/TabParent.h
+++ b/dom/ipc/TabParent.h
@@ -109,17 +109,16 @@ public:
      * capturer.
      */
     bool TryCapture(const WidgetGUIEvent& aEvent);
 
     void Destroy();
 
     virtual bool RecvMoveFocus(const bool& aForward) MOZ_OVERRIDE;
     virtual bool RecvEvent(const RemoteDOMEvent& aEvent) MOZ_OVERRIDE;
-    virtual bool RecvReplyKeyEvent(const WidgetKeyboardEvent& event);
     virtual bool RecvPRenderFrameConstructor(PRenderFrameParent* actor) MOZ_OVERRIDE;
     virtual bool RecvInitRenderFrame(PRenderFrameParent* aFrame,
                                      ScrollingBehavior* scrolling,
                                      TextureFactoryIdentifier* identifier,
                                      uint64_t* layersId,
                                      bool *aSuccess) MOZ_OVERRIDE;
     virtual bool RecvBrowserFrameOpenWindow(PBrowserParent* aOpener,
                                             const nsString& aURL,
--- a/dom/xbl/nsXBLService.cpp
+++ b/dom/xbl/nsXBLService.cpp
@@ -580,25 +580,16 @@ nsXBLService::AttachGlobalKeyHandler(Eve
   // listen to these events
   manager->AddEventListenerByType(handler, NS_LITERAL_STRING("keydown"),
                                   TrustedEventsAtSystemGroupBubble());
   manager->AddEventListenerByType(handler, NS_LITERAL_STRING("keyup"),
                                   TrustedEventsAtSystemGroupBubble());
   manager->AddEventListenerByType(handler, NS_LITERAL_STRING("keypress"),
                                   TrustedEventsAtSystemGroupBubble());
 
-  // The capturing listener is only used for XUL keysets to properly handle
-  // shortcut keys in a multi-process environment.
-  manager->AddEventListenerByType(handler, NS_LITERAL_STRING("keydown"),
-                                  TrustedEventsAtSystemGroupCapture());
-  manager->AddEventListenerByType(handler, NS_LITERAL_STRING("keyup"),
-                                  TrustedEventsAtSystemGroupCapture());
-  manager->AddEventListenerByType(handler, NS_LITERAL_STRING("keypress"),
-                                  TrustedEventsAtSystemGroupCapture());
-
   if (contentNode)
     return contentNode->SetProperty(nsGkAtoms::listener,
                                     handler.forget().take(),
                                     nsPropertyTable::SupportsDtorFunc, true);
 
   // The reference to the handler will be maintained by the event target,
   // and, if there is a content node, the property.
   return NS_OK;
@@ -634,23 +625,16 @@ nsXBLService::DetachGlobalKeyHandler(Eve
 
   manager->RemoveEventListenerByType(handler, NS_LITERAL_STRING("keydown"),
                                      TrustedEventsAtSystemGroupBubble());
   manager->RemoveEventListenerByType(handler, NS_LITERAL_STRING("keyup"),
                                      TrustedEventsAtSystemGroupBubble());
   manager->RemoveEventListenerByType(handler, NS_LITERAL_STRING("keypress"),
                                      TrustedEventsAtSystemGroupBubble());
 
-  manager->RemoveEventListenerByType(handler, NS_LITERAL_STRING("keydown"),
-                                     TrustedEventsAtSystemGroupCapture());
-  manager->RemoveEventListenerByType(handler, NS_LITERAL_STRING("keyup"),
-                                     TrustedEventsAtSystemGroupCapture());
-  manager->RemoveEventListenerByType(handler, NS_LITERAL_STRING("keypress"),
-                                     TrustedEventsAtSystemGroupCapture());
-
   contentNode->DeleteProperty(nsGkAtoms::listener);
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsXBLService::Observe(nsISupports* aSubject, const char* aTopic, const char16_t* aSomeData)
 {
--- a/dom/xbl/nsXBLWindowKeyHandler.cpp
+++ b/dom/xbl/nsXBLWindowKeyHandler.cpp
@@ -21,17 +21,16 @@
 #include "nsXBLPrototypeBinding.h"
 #include "nsPIDOMWindow.h"
 #include "nsIDocShell.h"
 #include "nsIPresShell.h"
 #include "nsISelectionController.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/TextEvents.h"
 #include "mozilla/dom/Element.h"
-#include "mozilla/dom/Event.h"
 #include "nsEventStateManager.h"
 #include "nsIEditor.h"
 #include "nsIHTMLEditor.h"
 #include "nsIDOMDocument.h"
 
 using namespace mozilla;
 using namespace mozilla::dom;
 
@@ -272,87 +271,58 @@ nsXBLWindowKeyHandler::WalkHandlers(nsID
   aKeyEvent->GetIsTrusted(&trustedEvent);
 
   if (!trustedEvent)
     return NS_OK;
 
   nsresult rv = EnsureHandlers();
   NS_ENSURE_SUCCESS(rv, rv);
 
-  bool isDisabled;
-  nsCOMPtr<Element> el = GetElement(&isDisabled);
+  nsCOMPtr<Element> el = GetElement();
   if (!el) {
     if (mUserHandler) {
-      WalkHandlersInternal(aKeyEvent, aEventType, mUserHandler, true);
+      WalkHandlersInternal(aKeyEvent, aEventType, mUserHandler);
       aKeyEvent->GetDefaultPrevented(&prevent);
       if (prevent)
         return NS_OK; // Handled by the user bindings. Our work here is done.
     }
   }
 
+  nsCOMPtr<nsIContent> content = do_QueryInterface(el);
   // skip keysets that are disabled
-  if (isDisabled) {
+  if (content && content->AttrValueIs(kNameSpaceID_None, nsGkAtoms::disabled,
+                                      nsGkAtoms::_true, eCaseMatters)) {
     return NS_OK;
   }
 
-  WalkHandlersInternal(aKeyEvent, aEventType, mHandler, true);
+  WalkHandlersInternal(aKeyEvent, aEventType, mHandler);
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsXBLWindowKeyHandler::HandleEvent(nsIDOMEvent* aEvent)
 {
   nsCOMPtr<nsIDOMKeyEvent> keyEvent(do_QueryInterface(aEvent));
   NS_ENSURE_TRUE(keyEvent, NS_ERROR_INVALID_ARG);
 
-  uint16_t eventPhase;
-  aEvent->GetEventPhase(&eventPhase);
-  if (eventPhase == nsIDOMEvent::CAPTURING_PHASE) {
-    HandleEventOnCapture(keyEvent);
-    return NS_OK;
-  }
-
   nsAutoString eventType;
   aEvent->GetType(eventType);
   nsCOMPtr<nsIAtom> eventTypeAtom = do_GetAtom(eventType);
   NS_ENSURE_TRUE(eventTypeAtom, NS_ERROR_OUT_OF_MEMORY);
 
-  return WalkHandlers(keyEvent, eventTypeAtom);
-}
-
-void
-nsXBLWindowKeyHandler::HandleEventOnCapture(nsIDOMKeyEvent* aEvent)
-{
-  WidgetKeyboardEvent* widgetEvent =
-    aEvent->GetInternalNSEvent()->AsKeyboardEvent();
-
-  if (widgetEvent->mFlags.mNoCrossProcessBoundaryForwarding) {
-    return;
+  if (!mWeakPtrForElement) {
+    nsCOMPtr<mozilla::dom::Element> originalTarget =
+      do_QueryInterface(aEvent->GetInternalNSEvent()->originalTarget);
+    if (nsEventStateManager::IsRemoteTarget(originalTarget)) {
+      return NS_OK;
+    }
   }
 
-  nsCOMPtr<mozilla::dom::Element> originalTarget =
-    do_QueryInterface(aEvent->GetInternalNSEvent()->originalTarget);
-  if (!nsEventStateManager::IsRemoteTarget(originalTarget)) {
-    return;
-  }
-
-  if (!HasHandlerForEvent(aEvent)) {
-    return;
-  }
-
-  // If this event hasn't been marked as mNoCrossProcessBoundaryForwarding
-  // yet, it means it wasn't processed by content. We'll not call any
-  // of the handlers at this moment, and will wait for the event to be
-  // redispatched with mNoCrossProcessBoundaryForwarding = 1 to process it.
-
-  // Inform the child process that this is a event that we want a reply
-  // from.
-  widgetEvent->mFlags.mWantReplyFromContentProcess = 1;
-  aEvent->StopPropagation();
+  return WalkHandlers(keyEvent, eventTypeAtom);
 }
 
 //
 // EventMatched
 //
 // See if the given handler cares about this particular key event
 //
 bool
@@ -416,50 +386,47 @@ nsXBLWindowKeyHandler::IsHTMLEditableFie
 
   return false;
 }
 
 //
 // WalkHandlersInternal and WalkHandlersAndExecute
 //
 // Given a particular DOM event and a pointer to the first handler in the list,
-// scan through the list to find something to handle the event. If aExecute = true,
-// the handler will be executed; otherwise just return an answer telling if a handler
-// for that event was found.
+// scan through the list to find something to handle the event and then make it
+// so.
 //
-bool
+nsresult
 nsXBLWindowKeyHandler::WalkHandlersInternal(nsIDOMKeyEvent* aKeyEvent,
                                             nsIAtom* aEventType, 
-                                            nsXBLPrototypeHandler* aHandler,
-                                            bool aExecute)
+                                            nsXBLPrototypeHandler* aHandler)
 {
   nsAutoTArray<nsShortcutCandidate, 10> accessKeys;
   nsContentUtils::GetAccelKeyCandidates(aKeyEvent, accessKeys);
 
   if (accessKeys.IsEmpty()) {
-    return WalkHandlersAndExecute(aKeyEvent, aEventType, aHandler,
-                                  0, false, aExecute);
+    WalkHandlersAndExecute(aKeyEvent, aEventType, aHandler, 0, false);
+    return NS_OK;
   }
 
   for (uint32_t i = 0; i < accessKeys.Length(); ++i) {
     nsShortcutCandidate &key = accessKeys[i];
     if (WalkHandlersAndExecute(aKeyEvent, aEventType, aHandler,
-                               key.mCharCode, key.mIgnoreShift, aExecute))
-      return true;
+                               key.mCharCode, key.mIgnoreShift))
+      return NS_OK;
   }
-  return false;
+  return NS_OK;
 }
 
 bool
 nsXBLWindowKeyHandler::WalkHandlersAndExecute(nsIDOMKeyEvent* aKeyEvent,
                                               nsIAtom* aEventType,
                                               nsXBLPrototypeHandler* aHandler,
                                               uint32_t aCharCode,
-                                              bool aIgnoreShiftKey,
-                                              bool aExecute)
+                                              bool aIgnoreShiftKey)
 {
   nsresult rv;
 
   // Try all of the handlers until we find one that matches the event.
   for (nsXBLPrototypeHandler *currHandler = aHandler; currHandler;
        currHandler = currHandler->GetNextHandler()) {
     bool stopped = aKeyEvent->IsDispatchStopped();
     if (stopped) {
@@ -519,61 +486,29 @@ nsXBLWindowKeyHandler::WalkHandlersAndEx
     nsCOMPtr<EventTarget> piTarget;
     nsCOMPtr<Element> element = GetElement();
     if (element) {
       piTarget = commandElt;
     } else {
       piTarget = mTarget;
     }
 
-    if (!aExecute) {
-      return true;
-    }
-
     rv = currHandler->ExecuteHandler(piTarget, aKeyEvent);
     if (NS_SUCCEEDED(rv)) {
       return true;
     }
   }
 
   return false;
 }
 
-bool
-nsXBLWindowKeyHandler::HasHandlerForEvent(nsIDOMKeyEvent* aEvent)
-{
-  if (!aEvent->InternalDOMEvent()->IsTrusted()) {
-    return false;
-  }
-
-  nsresult rv = EnsureHandlers();
-  NS_ENSURE_SUCCESS(rv, false);
-
-  bool isDisabled;
-  nsCOMPtr<Element> el = GetElement(&isDisabled);
-  if (el && isDisabled) {
-    return false;
-  }
-
-  nsAutoString eventType;
-  aEvent->GetType(eventType);
-  nsCOMPtr<nsIAtom> eventTypeAtom = do_GetAtom(eventType);
-  NS_ENSURE_TRUE(eventTypeAtom, false);
-
-  return WalkHandlersInternal(aEvent, eventTypeAtom, mHandler, false);
-}
-
 already_AddRefed<Element>
-nsXBLWindowKeyHandler::GetElement(bool* aIsDisabled)
+nsXBLWindowKeyHandler::GetElement()
 {
   nsCOMPtr<Element> element = do_QueryReferent(mWeakPtrForElement);
-  if (element && aIsDisabled) {
-    *aIsDisabled = element->AttrValueIs(kNameSpaceID_None, nsGkAtoms::disabled,
-                                        nsGkAtoms::_true, eCaseMatters);
-  }
   return element.forget();
 }
 
 ///////////////////////////////////////////////////////////////////////////////////
 
 already_AddRefed<nsXBLWindowKeyHandler>
 NS_NewXBLWindowKeyHandler(nsIDOMElement* aElement, EventTarget* aTarget)
 {
--- a/dom/xbl/nsXBLWindowKeyHandler.h
+++ b/dom/xbl/nsXBLWindowKeyHandler.h
@@ -30,51 +30,40 @@ public:
 
   NS_DECL_ISUPPORTS
   NS_DECL_NSIDOMEVENTLISTENER
 
 protected:
   nsresult WalkHandlers(nsIDOMKeyEvent* aKeyEvent, nsIAtom* aEventType);
 
   // walk the handlers, looking for one to handle the event
-  bool WalkHandlersInternal(nsIDOMKeyEvent* aKeyEvent,
-                            nsIAtom* aEventType,
-                            nsXBLPrototypeHandler* aHandler,
-                            bool aExecute);
+  nsresult WalkHandlersInternal(nsIDOMKeyEvent* aKeyEvent,
+                                nsIAtom* aEventType, 
+                                nsXBLPrototypeHandler* aHandler);
 
-  // walk the handlers for aEvent, aCharCode and aIgnoreShiftKey. Execute it
-  // if aExecute = true.
+  // walk the handlers for aEvent, aCharCode and aIgnoreShiftKey
   bool WalkHandlersAndExecute(nsIDOMKeyEvent* aKeyEvent, nsIAtom* aEventType,
-                              nsXBLPrototypeHandler* aHandler,
-                              uint32_t aCharCode, bool aIgnoreShiftKey,
-                              bool aExecute);
-
-  // HandleEvent function for the capturing phase.
-  void HandleEventOnCapture(nsIDOMKeyEvent* aEvent);
-
-  // Check if any handler would handle the given event.
-  bool HasHandlerForEvent(nsIDOMKeyEvent* aEvent);
+                                nsXBLPrototypeHandler* aHandler,
+                                uint32_t aCharCode, bool aIgnoreShiftKey);
 
   // lazily load the handlers. Overridden to handle being attached
   // to a particular element rather than the document
   nsresult EnsureHandlers();
 
   // check if the given handler cares about the given key event
   bool EventMatched(nsXBLPrototypeHandler* inHandler, nsIAtom* inEventType,
                       nsIDOMKeyEvent* inEvent, uint32_t aCharCode,
                       bool aIgnoreShiftKey);
 
   // Is an HTML editable element focused
   bool IsHTMLEditableFieldFocused();
 
   // Returns the element which was passed as a parameter to the constructor,
-  // unless the element has been removed from the document. Optionally returns
-  // whether the disabled attribute is set on the element (assuming the element
-  // is non-null).
-  already_AddRefed<mozilla::dom::Element> GetElement(bool* aIsDisabled = nullptr);
+  // unless the element has been removed from the document.
+  already_AddRefed<mozilla::dom::Element> GetElement();
   // Using weak pointer to the DOM Element.
   nsWeakPtr              mWeakPtrForElement;
   mozilla::dom::EventTarget* mTarget; // weak ref
 
   // these are not owning references; the prototype handlers are owned
   // by the prototype bindings which are owned by the docinfo.
   nsXBLPrototypeHandler* mHandler;     // platform bindings
   nsXBLPrototypeHandler* mUserHandler; // user-specific bindings
--- a/widget/BasicEvents.h
+++ b/widget/BasicEvents.h
@@ -548,21 +548,16 @@ public:
   // properties.  Note that this flag is ignored when
   // EventChainPreVisitor::mForceContentDispatch is set true.  For exapmle,
   // window and document object sets it true.  Therefore, web applications
   // can handle the event if they add event listeners to the window or the
   // document.
   bool    mNoContentDispatch : 1;
   // If mOnlyChromeDispatch is true, the event is dispatched to only chrome.
   bool    mOnlyChromeDispatch : 1;
-  // If mWantReplyFromContentProcess is true, the event will be redispatched
-  // in the parent process after the content process has handled it. Useful
-  // for when the parent process need the know first how the event was used
-  // by content before handling it itself.
-  bool mWantReplyFromContentProcess : 1;
 
   // If the event is being handled in target phase, returns true.
   inline bool InTargetPhase() const
   {
     return (mInBubblingPhase && mInCapturePhase);
   }
 
   inline void Clear()