Bug 781032 - Fix a crash in CSSParserImpl::SetDefaultNamespaceOnSelector by creating the nsCSSParser at a valid spot. r=bz

This commit is contained in:
Thaddee Tyl 2012-09-05 19:10:55 -04:00
parent 28e7684705
commit cc82c3a601
2 changed files with 4 additions and 2 deletions

View File

@ -791,6 +791,8 @@ CSSParserImpl::SetStyleSheet(nsCSSStyleSheet* aSheet)
} else {
mNameSpaceMap = nullptr;
}
} else if (mSheet) {
mNameSpaceMap = mSheet->GetNameSpaceMap();
}
return NS_OK;

View File

@ -2134,8 +2134,6 @@ nsCSSStyleSheet::ParseSheet(const nsAString& aInput)
loader = new css::Loader();
}
nsCSSParser parser(loader, this);
mozAutoDocUpdate updateBatch(mDocument, UPDATE_STYLE, true);
nsresult rv = WillDirty();
@ -2163,6 +2161,8 @@ nsCSSStyleSheet::ParseSheet(const nsAString& aInput)
// allow unsafe rules if the style sheet's principal is the system principal
bool allowUnsafeRules = nsContentUtils::IsSystemPrincipal(mInner->mPrincipal);
nsCSSParser parser(loader, this);
rv = parser.ParseSheet(aInput, mInner->mSheetURI, mInner->mBaseURI,
mInner->mPrincipal, 1, allowUnsafeRules);
DidDirty(); // we are always 'dirty' here since we always remove rules first