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

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

Issue 1169713004: Allow lax MIME type parsing for same-origin CSS in quirks mode. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Comment. Created 5 years, 6 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') | no next file » | 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 f63bc68c241819736812eac7b72d681b4324b090..19eed651110d0a6c0f998082775ad819179eadf9 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(MIMETypeCheck mimeTypeCheck) const
{
ASSERT(!isPurgeable());
- if (!m_data || m_data->isEmpty() || !canUseSheet(hasValidMIMEType))
+ if (!m_data || m_data->isEmpty() || !canUseSheet(mimeTypeCheck))
return String();
if (!m_decodedSheetText.isNull())
@@ -125,7 +125,7 @@ void CSSStyleSheetResource::destroyDecodedDataIfPossible()
setDecodedSize(0);
}
-bool CSSStyleSheetResource::canUseSheet(bool* hasValidMIMEType) const
+bool CSSStyleSheetResource::canUseSheet(MIMETypeCheck mimeTypeCheck) const
{
if (errorOccurred())
return false;
@@ -137,10 +137,9 @@ bool CSSStyleSheetResource::canUseSheet(bool* hasValidMIMEType) const
//
// This code defaults to allowing the stylesheet for non-HTTP protocols so
// folks can use standards mode for local HTML documents.
- bool typeOK = mimeType().isEmpty() || equalIgnoringCase(mimeType(), "text/css") || equalIgnoringCase(mimeType(), "application/x-unknown-content-type");
- if (hasValidMIMEType)
- *hasValidMIMEType = typeOK;
- return typeOK;
+ if (mimeTypeCheck == MIMETypeCheck::Lax)
+ return true;
+ return mimeType().isEmpty() || equalIgnoringCase(mimeType(), "text/css") || equalIgnoringCase(mimeType(), "application/x-unknown-content-type");
}
PassRefPtrWillBeRawPtr<StyleSheetContents> CSSStyleSheetResource::restoreParsedStyleSheet(const CSSParserContext& context)
« no previous file with comments | « Source/core/fetch/CSSStyleSheetResource.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698