Bug 1328420 Part 6: Implement ServoStyleSheet destructor. r=heycam

MozReview-Commit-ID: iVaza2s7d

--HG--
extra : rebase_source : 354979d2cb3d5ef95f2063f6c3a3c1dd3774c91f
This commit is contained in:
Brad Werth 2017-01-23 16:37:59 -08:00
Родитель 6f5346abb4
Коммит 9fd72f68f3
4 изменённых файлов: 25 добавлений и 12 удалений

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

@ -422,16 +422,8 @@ CSSStyleSheet::CSSStyleSheet(const CSSStyleSheet& aCopy,
CSSStyleSheet::~CSSStyleSheet()
{
for (StyleSheet* child = GetFirstChild();
child;
child = child->mNext) {
// XXXbz this is a little bogus; see the XXX comment where we
// declare mFirstChild.
if (child->mParent == this) {
child->mParent = nullptr;
child->mDocument = nullptr;
}
}
UnparentChildren();
DropRuleCollection();
mInner->RemoveSheet(this);
// XXX The document reference is not reference counted and should

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

@ -29,6 +29,8 @@ ServoStyleSheet::ServoStyleSheet(css::SheetParsingMode aParsingMode,
ServoStyleSheet::~ServoStyleSheet()
{
UnparentChildren();
DropSheet();
}

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

@ -308,6 +308,21 @@ StyleSheet::EnabledStateChanged()
#undef FORWARD_INTERNAL
void
StyleSheet::UnparentChildren()
{
// XXXbz this is a little bogus; see the XXX comment where we
// declare mFirstChild in StyleSheetInfo.
for (StyleSheet* child = GetFirstChild();
child;
child = child->mNext) {
if (child->mParent == this) {
child->mParent = nullptr;
child->mDocument = nullptr;
}
}
}
void
StyleSheet::SubjectSubsumesInnerPrincipal(nsIPrincipal& aSubjectPrincipal,
ErrorResult& aRv)

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

@ -218,6 +218,8 @@ private:
ErrorResult& aRv);
protected:
void UnparentChildren();
// Return success if the subject principal subsumes the principal of our
// inner, error otherwise. This will also succeed if the subject has
// UniversalXPConnect or if access is allowed by CORS. In the latter case,
@ -257,9 +259,11 @@ protected:
friend class ::nsCSSRuleProcessor;
friend struct mozilla::ChildSheetListBuilder;
// Make CSSStyleSheet a friend so it can access protected members of
// other StyleSheet objects (useful for iterating through children).
// Make CSSStyleSheet and ServoStyleSheet friends so they can access
// protected members of other StyleSheet objects (useful for iterating
// through children).
friend class mozilla::CSSStyleSheet;
friend class mozilla::ServoStyleSheet;
};
} // namespace mozilla