summaryrefslogtreecommitdiffstats
path: root/dom
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@wolfbeast.com>2019-01-19 11:36:47 +0100
committerwolfbeast <mcwerewolf@wolfbeast.com>2019-01-19 11:36:47 +0100
commit9adcf4429d36716fb3fd70ef0a230e725865d8be (patch)
treeb3a9282db54ebd9520a32d316a7a9742c564c466 /dom
parentac1beef5c10a114afe18897d5d3ced24ac378b92 (diff)
downloadUXP-9adcf4429d36716fb3fd70ef0a230e725865d8be.tar
UXP-9adcf4429d36716fb3fd70ef0a230e725865d8be.tar.gz
UXP-9adcf4429d36716fb3fd70ef0a230e725865d8be.tar.lz
UXP-9adcf4429d36716fb3fd70ef0a230e725865d8be.tar.xz
UXP-9adcf4429d36716fb3fd70ef0a230e725865d8be.zip
Actually unlink targets from registered intersection observers.
When a node is released/removed, and it has an intersection observer attached to it, that observer should be unlinked at the time of release. This resolves #935.
Diffstat (limited to 'dom')
-rw-r--r--dom/base/nsNodeUtils.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/dom/base/nsNodeUtils.cpp b/dom/base/nsNodeUtils.cpp
index ecea95dc1..75d408151 100644
--- a/dom/base/nsNodeUtils.cpp
+++ b/dom/base/nsNodeUtils.cpp
@@ -297,6 +297,16 @@ nsNodeUtils::LastRelease(nsINode* aNode)
NodeWillBeDestroyed, (aNode));
}
+ if (aNode->IsElement()) {
+ Element* elem = aNode->AsElement();
+ FragmentOrElement::nsDOMSlots* domSlots =
+ static_cast<FragmentOrElement::nsDOMSlots*>(slots);
+ for (auto iter = domSlots->mRegisteredIntersectionObservers.Iter(); !iter.Done(); iter.Next()) {
+ DOMIntersectionObserver* observer = iter.Key();
+ observer->UnlinkTarget(*elem);
+ }
+ }
+
delete slots;
aNode->mSlots = nullptr;
}