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

This commit is contained in:
pierre%netscape.com 2000-01-08 10:09:00 +00:00
Родитель 4c62ae9fcb
Коммит 3e61f6f55d
2 изменённых файлов: 50 добавлений и 2 удалений

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

@ -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);

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

@ -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);