diff --git a/content/base/src/nsDocument.cpp b/content/base/src/nsDocument.cpp index 40347c7cb22d..070868d73f20 100644 --- a/content/base/src/nsDocument.cpp +++ b/content/base/src/nsDocument.cpp @@ -3974,7 +3974,13 @@ nsDocument::PreHandleEvent(nsEventChainPreVisitor& aVisitor) // FIXME! This is a hack to make middle mouse paste working also in Editor. // Bug 329119 aVisitor.mForceContentDispatch = PR_TRUE; - aVisitor.mParentTarget = GetWindow(); + + // Load events must not propagate to |window| object, see bug 335251. + if (!(aVisitor.mEvent->message == NS_IMAGE_LOAD || + aVisitor.mEvent->message == NS_PAGE_LOAD || + aVisitor.mEvent->message == NS_SCRIPT_LOAD)) { + aVisitor.mParentTarget = GetWindow(); + } return NS_OK; } diff --git a/dom/src/base/nsGlobalWindow.cpp b/dom/src/base/nsGlobalWindow.cpp index bfa23e77a5a7..908ec61aacec 100644 --- a/dom/src/base/nsGlobalWindow.cpp +++ b/dom/src/base/nsGlobalWindow.cpp @@ -1721,9 +1721,7 @@ nsGlobalWindow::PreHandleEvent(nsEventChainPreVisitor& aVisitor) } // Check chrome document capture here. - // XXX The chrome can not handle this, see bug 51211 - // FIXME Fix this for other *LOAD events, bug 329514. - if (mChromeEventHandler && msg != NS_IMAGE_LOAD) { + if (mChromeEventHandler) { aVisitor.mParentTarget = mChromeEventHandler; aVisitor.mParentIsChromeHandler = PR_TRUE; }