| 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;
|
| }
|
|
|
|
|