diff options
author | Brian Smith <brian@dbsoft.org> | 2023-08-06 22:35:51 -0500 |
---|---|---|
committer | Brian Smith <brian@dbsoft.org> | 2023-08-06 22:35:51 -0500 |
commit | 9dda91e5cb765d0f6d9fdd598fd514a0d28eae1f (patch) | |
tree | e972aa3c7b6f7a7c6abef6925ee97a63194fa95d | |
parent | 39d52370dc5b1695a5bd7eba505ffc6d39d31509 (diff) | |
download | uxp-9dda91e5cb765d0f6d9fdd598fd514a0d28eae1f.tar.gz |
Issue #2285 - Ensure we don't try to treat non-DOM-Node event targets as such,
https://bugzilla.mozilla.org/show_bug.cgi?id=1440809
Fix crash on https://beeper.notion.site
-rw-r--r-- | dom/base/FragmentOrElement.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/dom/base/FragmentOrElement.cpp b/dom/base/FragmentOrElement.cpp index ccfe960cb7..3438c0c733 100644 --- a/dom/base/FragmentOrElement.cpp +++ b/dom/base/FragmentOrElement.cpp @@ -1022,7 +1022,12 @@ nsIContent::GetEventTargetParent(EventChainPreVisitor& aVisitor) nsContentUtils::Retarget(relatedTargetAsNode, this); nsCOMPtr<nsINode> targetInKnownToBeHandledScope = FindChromeAccessOnlySubtreeOwner(aVisitor.mTargetInKnownToBeHandledScope); - if (nsContentUtils::ContentIsShadowIncludingDescendantOf( + // If aVisitor.mTargetInKnownToBeHandledScope wasn't nsINode, + // targetInKnownToBeHandledScope will be null. This may happen when + // dispatching event to Window object in a content page and + // propagating the event to a chrome Element. + if (targetInKnownToBeHandledScope && + nsContentUtils::ContentIsShadowIncludingDescendantOf( this, targetInKnownToBeHandledScope->SubtreeRoot())) { // Part of step 11.4. // "If target's root is a shadow-including inclusive ancestor of |