if ((0 == mimeType.Length()) || mimeType.EqualsIgnoreCase("text/css")) {
nsDTDMode mode; mHTMLDocument->GetDTDMode(mode);  PRBool isStyleSheet = PR_FALSE; if (eDTDMode_NoQuirks == mode) { if (mimeType.EqualsIgnoreCase("text/css")) { isStyleSheet = PR_TRUE; } else { if (0 == mimeType.Length()) { nsString extension; aHref.Right(extension, 4); if (extension == ".css") { isStyleSheet = PR_TRUE; } } } } else { if (0 == mimeType.Length() || mimeType.EqualsIgnoreCase("text/css")) { isStyleSheet = PR_TRUE; } }  if (isStyleSheet) {
HTMLContentSink::ProcessStyleLink(nsIHTMLContent* aElement,                                  const nsString& aHref, const nsString& aRel,                                  const nsString& aTitle, const nsString& aType,                                  const nsString& aMedia){  nsresult result = NS_OK;  nsStringArray linkTypes;  ParseLinkTypes(aRel, linkTypes);  if (-1 != linkTypes.IndexOf("stylesheet")) {  // is it a stylesheet link?    if (-1 != linkTypes.IndexOf("alternate")) { // if alternate, does it have title?      if (0 == aTitle.Length()) { // alternates must have title        return NS_OK; //return without error, for now      }    }    nsAutoString  mimeType;    nsAutoString  params;    SplitMimeType(aType, mimeType, params);    if ((0 == mimeType.Length()) || mimeType.EqualsIgnoreCase("text/css")) {      nsIURI* url = nsnull;      {        result = NS_NewURI(&url, aHref, mDocumentBaseURL);      }      if (NS_OK != result) {        return NS_OK; // The URL is bad, move along, don't propogate the error (for now)      }      if (-1 == linkTypes.IndexOf("alternate")) {        if (0 < aTitle.Length()) {  // possibly preferred sheet          if (0 == mPreferredStyle.Length()) {            mPreferredStyle = aTitle;            mCSSLoader->SetPreferredSheet(aTitle);            mDocument->SetHeaderData(nsHTMLAtoms::headerDefaultStyle, aTitle);          }        }      }      PRBool blockParser = PR_FALSE;      if (-1 != linkTypes.IndexOf("important")) {        blockParser = PR_TRUE;      }      PRBool doneLoading;      result = mCSSLoader->LoadStyleLink(aElement, url, aTitle, aMedia, kNameSpaceID_HTML,                                         mStyleSheetCount++,                                          ((blockParser) ? mParser : nsnull),                                         doneLoading,                                          this);      NS_RELEASE(url);      if (NS_SUCCEEDED(result) && blockParser && (! doneLoading)) {        result = NS_ERROR_HTMLPARSER_BLOCK;      }    }  }  return result;}