Bug 1631057 - Remove adopted sheets from styles on unlink r=emilio

Differential Revision: https://phabricator.services.mozilla.com/D71377
This commit is contained in:
Erik Nordin 2020-04-28 18:38:39 +00:00
Родитель 4452987eb3
Коммит cacf520bf8
1 изменённых файлов: 4 добавлений и 3 удалений

Просмотреть файл

@ -820,9 +820,10 @@ void DocumentOrShadowRoot::Unlink(DocumentOrShadowRoot* tmp) {
tmp->RemoveSheetFromStylesIfApplicable(*sheet);
}
NS_IMPL_CYCLE_COLLECTION_UNLINK(mStyleSheets);
for (StyleSheet* sheet : tmp->mAdoptedStyleSheets) {
sheet->RemoveAdopter(*tmp);
}
tmp->EnumerateUniqueAdoptedStyleSheetsBackToFront([&](StyleSheet& aSheet) {
aSheet.RemoveAdopter(*tmp);
tmp->RemoveSheetFromStylesIfApplicable(aSheet);
});
NS_IMPL_CYCLE_COLLECTION_UNLINK(mAdoptedStyleSheets);
tmp->mIdentifierMap.Clear();
tmp->mRadioGroups.Clear();