Bug 18817 "autodetection of content-type used": in strict mode, requires the mime type to be specified if the style sheet doesn't have a '.css' extension (otherwise the style sheet is ignored).

git-svn-id: svn://10.0.0.236/trunk@57196 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
pierre%netscape.com
2000-01-08 10:09:00 +00:00
parent 40c5f98e07
commit 1de0179819
2 changed files with 50 additions and 2 deletions

View File

@@ -3429,7 +3429,31 @@ HTMLContentSink::ProcessStyleLink(nsIHTMLContent* aElement,
nsAutoString params;
SplitMimeType(aType, mimeType, params);
if ((0 == mimeType.Length()) || mimeType.EqualsIgnoreCase("text/css")) {
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 == ".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);