Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(901)

Unified Diff: Source/core/fetch/CSSStyleSheetResource.cpp

Issue 904143002: Revert "CSS: Drop the quirks-mode exception for CSS MIME types." (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/fetch/CSSStyleSheetResource.h ('k') | Source/core/inspector/InspectorPageAgent.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/fetch/CSSStyleSheetResource.cpp
diff --git a/Source/core/fetch/CSSStyleSheetResource.cpp b/Source/core/fetch/CSSStyleSheetResource.cpp
index 7281e1ead5ba6d27217131cb60f303d6d48f0d43..869d7ca543715dce7f4a7c78d1f82958ea7da477 100644
--- a/Source/core/fetch/CSSStyleSheetResource.cpp
+++ b/Source/core/fetch/CSSStyleSheetResource.cpp
@@ -77,11 +77,11 @@ void CSSStyleSheetResource::didAddClient(ResourceClient* c)
static_cast<StyleSheetResourceClient*>(c)->setCSSStyleSheet(m_resourceRequest.url(), m_response.url(), encoding(), this);
}
-const String CSSStyleSheetResource::sheetText(bool* hasValidMIMEType) const
+const String CSSStyleSheetResource::sheetText(bool enforceMIMEType, bool* hasValidMIMEType) const
{
ASSERT(!isPurgeable());
- if (!m_data || m_data->isEmpty() || !canUseSheet(hasValidMIMEType))
+ if (!m_data || m_data->isEmpty() || !canUseSheet(enforceMIMEType, hasValidMIMEType))
return String();
if (!m_decodedSheetText.isNull())
@@ -125,11 +125,14 @@ void CSSStyleSheetResource::destroyDecodedDataIfPossible()
setDecodedSize(0);
}
-bool CSSStyleSheetResource::canUseSheet(bool* hasValidMIMEType) const
+bool CSSStyleSheetResource::canUseSheet(bool enforceMIMEType, bool* hasValidMIMEType) const
{
if (errorOccurred())
return false;
+ if (!enforceMIMEType && !hasValidMIMEType)
+ return true;
+
// This check exactly matches Firefox. Note that we grab the Content-Type
// header directly because we want to see what the value is BEFORE content
// sniffing. Firefox does this by setting a "type hint" on the channel.
@@ -140,6 +143,8 @@ bool CSSStyleSheetResource::canUseSheet(bool* hasValidMIMEType) const
bool typeOK = mimeType().isEmpty() || equalIgnoringCase(mimeType(), "text/css") || equalIgnoringCase(mimeType(), "application/x-unknown-content-type");
if (hasValidMIMEType)
*hasValidMIMEType = typeOK;
+ if (!enforceMIMEType)
+ return true;
return typeOK;
}
« no previous file with comments | « Source/core/fetch/CSSStyleSheetResource.h ('k') | Source/core/inspector/InspectorPageAgent.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698