From be7e2afbcf3ac741449ca928b20744ce704e5fc6 Mon Sep 17 00:00:00 2001 From: wuggy Date: Fri, 7 Aug 2026 20:27:22 -0700 Subject: [PATCH] accept any MIME type for a style sheet to match modern browsers --- layout/style/Loader.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/layout/style/Loader.cpp b/layout/style/Loader.cpp index 581fe9622d..a6a471a0b8 100644 --- a/layout/style/Loader.cpp +++ b/layout/style/Loader.cpp @@ -885,9 +885,10 @@ SheetLoadData::OnStreamComplete(nsIUnicharStreamLoader* aLoader, } // In standards mode, a style sheet must have one of these MIME - // types to be processed at all. In quirks mode, we accept any - // MIME type, but only if the style sheet is same-origin with the - // requesting document or parent sheet. See bug 524223. + // types to be processed at all, unless it is same-origin. + // For same-origin sheets, we accept any MIME type to match modern + // browser behavior (Chrome, Firefox). Cross-origin sheets require + // a valid CSS MIME type for security. bool validType = contentType.EqualsLiteral("text/css") || contentType.EqualsLiteral(UNKNOWN_CONTENT_TYPE) || @@ -906,7 +907,7 @@ SheetLoadData::OnStreamComplete(nsIUnicharStreamLoader* aLoader, } } - if (sameOrigin && mLoader->mCompatMode == eCompatibility_NavQuirks) { + if (sameOrigin) { errorMessage = "MimeNotCssWarn"; errorFlag = nsIScriptError::warningFlag; } else {