Back out 567d2bba4f97 (bug 933483) for causing bug 946726
authorPhil Ringnalda <philringnalda@gmail.com>
Fri, 06 Dec 2013 19:11:11 -0800
changeset 175003 42b2a2adda8f06fb27ad90c2feff962403a34c1c
parent 175002 0e7592478aa504a9c53db721e1f5542c26823b6c
child 175004 2edc8b5d46cf3bed3f613b88a3fa484db57b3e0a
child 175025 5ac63cd8d6f4578329ee9bedc652e7994fd5ebb6
child 175039 54fb89e91eee5da2737c303f2ac8dddc516cb4c1
child 175099 2b29137104a999de162dfd9f47651c1588fd4245
push id445
push userffxbld
push dateMon, 10 Mar 2014 22:05:19 +0000
treeherdermozilla-release@dc38b741b04e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs933483, 946726
milestone28.0a1
backs out567d2bba4f979f913eb64aa3f5d4ae8c8cd26fb8
first release with
nightly linux32
42b2a2adda8f / 28.0a1 / 20131207030203 / files
nightly linux64
42b2a2adda8f / 28.0a1 / 20131207030203 / files
nightly mac
42b2a2adda8f / 28.0a1 / 20131207030203 / files
nightly win32
42b2a2adda8f / 28.0a1 / 20131207030203 / files
nightly win64
42b2a2adda8f / 28.0a1 / 20131207030203 / files
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Back out 567d2bba4f97 (bug 933483) for causing bug 946726
content/base/src/nsDocument.cpp
dom/base/nsFocusManager.cpp
dom/base/nsGlobalWindow.cpp
--- a/content/base/src/nsDocument.cpp
+++ b/content/base/src/nsDocument.cpp
@@ -8536,27 +8536,21 @@ static void
 FireOrClearDelayedEvents(nsTArray<nsCOMPtr<nsIDocument> >& aDocuments,
                          bool aFireEvents)
 {
   nsIFocusManager* fm = nsFocusManager::GetFocusManager();
   if (!fm)
     return;
 
   for (uint32_t i = 0; i < aDocuments.Length(); ++i) {
-    // NB: Don't bother trying to fire delayed events on documents that were
-    // closed before this event ran.
     if (!aDocuments[i]->EventHandlingSuppressed()) {
       fm->FireDelayedEvents(aDocuments[i]);
       nsCOMPtr<nsIPresShell> shell = aDocuments[i]->GetShell();
       if (shell) {
-        // Only fire events for active documents.
-        bool fire = aFireEvents &&
-                    aDocuments[i]->GetInnerWindow() &&
-                    aDocuments[i]->GetInnerWindow()->IsCurrentInnerWindow();
-        shell->FireOrClearDelayedEvents(fire);
+        shell->FireOrClearDelayedEvents(aFireEvents);
       }
     }
   }
 }
 
 void
 nsDocument::MaybePreLoadImage(nsIURI* uri, const nsAString &aCrossOriginAttr)
 {
--- a/dom/base/nsFocusManager.cpp
+++ b/dom/base/nsFocusManager.cpp
@@ -987,33 +987,26 @@ nsFocusManager::WindowHidden(nsIDOMWindo
 }
 
 NS_IMETHODIMP
 nsFocusManager::FireDelayedEvents(nsIDocument* aDocument)
 {
   NS_ENSURE_ARG(aDocument);
 
   // fire any delayed focus and blur events in the same order that they were added
-  for (uint32_t i = 0; i < mDelayedBlurFocusEvents.Length(); i++) {
-    if (mDelayedBlurFocusEvents[i].mDocument == aDocument) {
-      if (!aDocument->GetInnerWindow() ||
-          !aDocument->GetInnerWindow()->IsCurrentInnerWindow()) {
-        // If the document was navigated away from or is defunct, don't bother
-        // firing events on it. Note the symmetry between this condition and
-        // the similar one in nsDocument.cpp:FireOrClearDelayedEvents.
-        mDelayedBlurFocusEvents.RemoveElementAt(i);
-        --i;
-      } else if (!aDocument->EventHandlingSuppressed()) {
-        uint32_t type = mDelayedBlurFocusEvents[i].mType;
-        nsCOMPtr<EventTarget> target = mDelayedBlurFocusEvents[i].mTarget;
-        nsCOMPtr<nsIPresShell> presShell = mDelayedBlurFocusEvents[i].mPresShell;
-        mDelayedBlurFocusEvents.RemoveElementAt(i);
-        SendFocusOrBlurEvent(type, presShell, aDocument, target, 0, false);
-        --i;
-      }
+  for (uint32_t i = 0; i < mDelayedBlurFocusEvents.Length(); i++)
+  {
+    if (mDelayedBlurFocusEvents[i].mDocument == aDocument &&
+        !aDocument->EventHandlingSuppressed()) {
+      uint32_t type = mDelayedBlurFocusEvents[i].mType;
+      nsCOMPtr<EventTarget> target = mDelayedBlurFocusEvents[i].mTarget;
+      nsCOMPtr<nsIPresShell> presShell = mDelayedBlurFocusEvents[i].mPresShell;
+      mDelayedBlurFocusEvents.RemoveElementAt(i);
+      SendFocusOrBlurEvent(type, presShell, aDocument, target, 0, false);
+      --i;
     }
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsFocusManager::FocusPlugin(nsIContent* aContent)
--- a/dom/base/nsGlobalWindow.cpp
+++ b/dom/base/nsGlobalWindow.cpp
@@ -8187,18 +8187,20 @@ nsGlobalWindow::EnterModalState()
       }
     }
   }
 
   if (topWin->mModalStateDepth == 0) {
     NS_ASSERTION(!mSuspendedDoc, "Shouldn't have mSuspendedDoc here!");
 
     mSuspendedDoc = topWin->GetExtantDoc();
-    if (mSuspendedDoc) {
+    if (mSuspendedDoc && mSuspendedDoc->EventHandlingSuppressed()) {
       mSuspendedDoc->SuppressEventHandling();
+    } else {
+      mSuspendedDoc = nullptr;
     }
   }
   topWin->mModalStateDepth++;
 }
 
 // static
 void
 nsGlobalWindow::RunPendingTimeoutsRecursive(nsGlobalWindow *aTopWindow,