mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-25 11:15:34 +00:00
Bug 1473637: Unbind ShadowRoot during unlinking. r=smaug
MozReview-Commit-ID: 7cWtZ5epRqK
This commit is contained in:
parent
ef58e3064f
commit
8d2f22c0d8
@ -763,10 +763,12 @@ FragmentOrElement::nsExtendedDOMSlots::UnlinkExtendedSlots()
|
||||
|
||||
// Don't clear mXBLBinding, it'll be done in
|
||||
// BindingManager::RemovedFromDocument from FragmentOrElement::Unlink.
|
||||
//
|
||||
// mShadowRoot will similarly be cleared explicitly from
|
||||
// FragmentOrElement::Unlink.
|
||||
mSMILOverrideStyle = nullptr;
|
||||
mControllers = nullptr;
|
||||
mLabelsList = nullptr;
|
||||
mShadowRoot = nullptr;
|
||||
if (mCustomElementData) {
|
||||
mCustomElementData->Unlink();
|
||||
mCustomElementData = nullptr;
|
||||
@ -1500,6 +1502,17 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(FragmentOrElement)
|
||||
// containing shadow root pointer.
|
||||
tmp->UnsetFlags(NODE_IS_IN_SHADOW_TREE);
|
||||
|
||||
if (ShadowRoot* shadowRoot = tmp->GetShadowRoot()) {
|
||||
for (nsIContent* child = shadowRoot->GetFirstChild();
|
||||
child;
|
||||
child = child->GetNextSibling()) {
|
||||
child->UnbindFromTree(true, false);
|
||||
}
|
||||
|
||||
shadowRoot->SetIsComposedDocParticipant(false);
|
||||
tmp->ExtendedDOMSlots()->mShadowRoot = nullptr;
|
||||
}
|
||||
|
||||
nsIDocument* doc = tmp->OwnerDoc();
|
||||
doc->BindingManager()->RemovedFromDocument(tmp, doc,
|
||||
nsBindingManager::eDoNotRunDtor);
|
||||
|
Loading…
Reference in New Issue
Block a user