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

Bug 289765, r+sr=jst, a=asa


git-svn-id: svn://10.0.0.236/trunk@172027 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
bzbarsky%mit.edu
2005-04-12 15:29:20 +00:00
parent aaf83eafa8
commit 59247538c5
2 changed files with 12 additions and 1 deletions

View File

@@ -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++) {

View File

@@ -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.