Bug 1368690: Move EnsureUniqueInner call after all the members have been initialized. r=xidorn

MozReview-Commit-ID: GoeLsjSAU00
This commit is contained in:
Emilio Cobos Álvarez 2017-05-31 12:27:56 +02:00
Родитель e2b80fffd2
Коммит d7b79ff0f9
3 изменённых файлов: 18 добавлений и 6 удалений

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

@ -361,6 +361,15 @@ CSSStyleSheet::CSSStyleSheet(const CSSStyleSheet& aCopy,
mRuleProcessors(nullptr)
{
mParent = aParentToUse;
if (mDirty) { // CSSOM's been there, force full copy now
NS_ASSERTION(mInner->mComplete, "Why have rules been accessed on an incomplete sheet?");
// FIXME: handle failure?
//
// NOTE: It's important to call this from the subclass, since it could
// access uninitialized members otherwise.
EnsureUniqueInner();
}
}
CSSStyleSheet::~CSSStyleSheet()

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

@ -87,6 +87,15 @@ ServoStyleSheet::ServoStyleSheet(const ServoStyleSheet& aCopy,
: StyleSheet(aCopy, aOwnerRuleToUse, aDocumentToUse, aOwningNodeToUse)
{
mParent = aParentToUse;
if (mDirty) { // CSSOM's been there, force full copy now
NS_ASSERTION(mInner->mComplete, "Why have rules been accessed on an incomplete sheet?");
// FIXME: handle failure?
//
// NOTE: It's important to call this from the subclass, since this could
// access uninitialized members otherwise.
EnsureUniqueInner();
}
}
ServoStyleSheet::~ServoStyleSheet()

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

@ -54,12 +54,6 @@ StyleSheet::StyleSheet(const StyleSheet& aCopy,
MOZ_ASSERT(mInner, "Should only copy StyleSheets with an mInner.");
mInner->AddSheet(this);
if (mDirty) { // CSSOM's been there, force full copy now
NS_ASSERTION(mInner->mComplete, "Why have rules been accessed on an incomplete sheet?");
// FIXME: handle failure?
EnsureUniqueInner();
}
if (aCopy.mMedia) {
// XXX This is wrong; we should be keeping @import rules and
// sheets in sync!