Make sure we've tried to create our CSSLoader before we try to dereference it.

Bug 289765, r+sr=jst, a=asa
This commit is contained in:
bzbarsky%mit.edu 2005-04-12 15:29:20 +00:00
Родитель bb1b37f305
Коммит c12c593778
2 изменённых файлов: 12 добавлений и 1 удалений

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

@ -1221,7 +1221,14 @@ nsDocument::SetHeaderData(nsIAtom* aHeaderField, const nsAString& aData)
nsAutoString title;
PRInt32 index;
mCSSLoader->SetPreferredSheet(aData);
// We lazily create our CSSLoader.
// XXXbz why? Wouldn't it make more sense to just create it at
// document creation and not do all these null-checks all over?
nsICSSLoader* cssLoader = GetCSSLoader();
if (!cssLoader) {
return NS_ERROR_OUT_OF_MEMORY;
}
cssLoader->SetPreferredSheet(aData);
PRInt32 count = mStyleSheets.Count();
for (index = 0; index < count; index++) {

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

@ -673,6 +673,10 @@ nsHTMLDocument::StartDocumentLoad(const char* aCommand,
nsCAutoString contentType;
aChannel->GetContentType(contentType);
// Note: we MUST set the compat mode and default namespace ID before we call
// StartDocumentLoad on our superclass (since that could force creation of a
// CSSLoader and the CSSLoader creation needs to know our compat mode and
// case sensitivity.
if (contentType.Equals("application/xhtml+xml") &&
(!aCommand || nsCRT::strcmp(aCommand, "view-source") != 0)) {
// We're parsing XHTML as XML, remember that.