Bug 1044586 - fix propagating document events to the window when the inner window has changed, r=smaug
authorGijs Kruitbosch <gijskruitbosch@gmail.com>
Wed, 30 Nov 2016 18:33:55 +0000
changeset 324860 512d5944a602d037a7c3455190a41f39aab37c9a
parent 324859 800a887c705e02042a53d9093e9c4feb4a4c97cb
child 324861 c396937ada0f756403e473b580c36a05eedf2231
push id84525
push userphilringnalda@gmail.com
push dateThu, 01 Dec 2016 03:22:09 +0000
treeherdermozilla-inbound@b1d875f4c673 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1044586
milestone53.0a1
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
Bug 1044586 - fix propagating document events to the window when the inner window has changed, r=smaug MozReview-Commit-ID: G6yPBwbITvG
dom/base/nsDocument.cpp
--- a/dom/base/nsDocument.cpp
+++ b/dom/base/nsDocument.cpp
@@ -7615,19 +7615,22 @@ nsDocument::GetEventTargetParent(EventCh
 {
   aVisitor.mCanHandle = true;
    // FIXME! This is a hack to make middle mouse paste working also in Editor.
    // Bug 329119
   aVisitor.mForceContentDispatch = true;
 
   // Load events must not propagate to |window| object, see bug 335251.
   if (aVisitor.mEvent->mMessage != eLoad) {
-    nsGlobalWindow* window = nsGlobalWindow::Cast(GetWindow());
-    aVisitor.mParentTarget =
-      window ? window->GetTargetForEventTargetChain() : nullptr;
+    nsPIDOMWindowInner* innerWindow = GetInnerWindow();
+    if (innerWindow && innerWindow->IsCurrentInnerWindow()) {
+      nsGlobalWindow* window = nsGlobalWindow::Cast(GetWindow());
+      aVisitor.mParentTarget =
+        window ? window->GetTargetForEventTargetChain() : nullptr;
+    }
   }
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsDocument::CreateEvent(const nsAString& aEventType, nsIDOMEvent** aReturn)
 {
   NS_ENSURE_ARG_POINTER(aReturn);