if (eDTDMode_noquirks== mode) {
if (eDTDMode_strict== mode) {
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);  PRBool isAlternate = PR_FALSE;  if (-1 != linkTypes.IndexOf(NS_ConvertASCIItoUCS2("stylesheet"))) {  // is it a stylesheet link?    if (-1 != linkTypes.IndexOf(NS_ConvertASCIItoUCS2("alternate"))) { // if alternate, does it have title?      if (0 == aTitle.Length()) { // alternates must have title        return NS_OK; //return without error, for now      } else {        isAlternate = PR_TRUE;      }    }    nsAutoString  mimeType;    nsAutoString  params;    SplitMimeType(aType, mimeType, params);		nsDTDMode mode;		mHTMLDocument->GetDTDMode(mode);		PRBool isStyleSheet = PR_FALSE;			// see bug 18817		if (eDTDMode_noquirks== mode) {			if (mimeType.EqualsIgnoreCase("text/css")) {				isStyleSheet = PR_TRUE;					// strict mode + good mime type			}			else {				if (0 == mimeType.Length()) {					nsString extension;					aHref.Right(extension, 4);					if (extension.EqualsWithConversion(".css")) {						isStyleSheet = PR_TRUE;			// strict mode + no mime type + '.css' extension					}				}			}		}		else {			if (0 == mimeType.Length() || mimeType.EqualsIgnoreCase("text/css")) {				isStyleSheet = PR_TRUE;					// quirks mode + good mime type or no mime type at all			}		}		    if (isStyleSheet) {      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(NS_ConvertASCIItoUCS2("alternate"))) {        if (0 < aTitle.Length()) {  // possibly preferred sheet          if (0 == mPreferredStyle.Length()) {            mPreferredStyle = aTitle;            mCSSLoader->SetPreferredSheet(aTitle);            mDocument->SetHeaderData(nsHTMLAtoms::headerDefaultStyle, aTitle);          }        }      }      PRBool blockParser = kBlockByDefault;      if (isAlternate) {        blockParser = PR_FALSE;      }      /* NOTE: no longer honoring the important keyword to indicate blocking               as it is proprietary and unnecessary since all non-alternate                will block the parser now  -mja      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;}