summaryrefslogtreecommitdiff
path: root/dom/base/FragmentOrElement.cpp
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@gmail.com>2018-06-27 16:00:53 +0200
committerwolfbeast <mcwerewolf@gmail.com>2018-06-27 16:00:53 +0200
commit8b71cda1956ab640ad76bea36e7971476aa78bcf (patch)
treec369019586632332b2627225eb7f6adab1e285d8 /dom/base/FragmentOrElement.cpp
parent9168a0fc95f523c7c852ca95969edb39069f4a03 (diff)
downloaduxp-8b71cda1956ab640ad76bea36e7971476aa78bcf.tar.gz
Stabilize and align Intersection Observers
- Fixes several crashes - Aligns the feature with the W3C WD spec Tag #249
Diffstat (limited to 'dom/base/FragmentOrElement.cpp')
-rw-r--r--dom/base/FragmentOrElement.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/dom/base/FragmentOrElement.cpp b/dom/base/FragmentOrElement.cpp
index b22a0d4ffa..fde983e7cb 100644
--- a/dom/base/FragmentOrElement.cpp
+++ b/dom/base/FragmentOrElement.cpp
@@ -608,6 +608,7 @@ FragmentOrElement::nsDOMSlots::Unlink(bool aIsXUL)
mLabelsList = nullptr;
mCustomElementData = nullptr;
mClassList = nullptr;
+ mRegisteredIntersectionObservers.Clear();
}
size_t
@@ -1359,6 +1360,13 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(FragmentOrElement)
{
nsDOMSlots *slots = tmp->GetExistingDOMSlots();
if (slots) {
+ if (tmp->IsElement()) {
+ Element* elem = tmp->AsElement();
+ for (auto iter = slots->mRegisteredIntersectionObservers.Iter(); !iter.Done(); iter.Next()) {
+ DOMIntersectionObserver* observer = iter.Key();
+ observer->UnlinkTarget(*elem);
+ }
+ }
slots->Unlink(tmp->IsXULElement());
}
}