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

Unified Diff: Source/core/inspector/NetworkResourcesData.cpp

Issue 94893003: Support for json media types as (non-image) mime types. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years 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
Index: Source/core/inspector/NetworkResourcesData.cpp
diff --git a/Source/core/inspector/NetworkResourcesData.cpp b/Source/core/inspector/NetworkResourcesData.cpp
index 0cd8d6832a1635a3be05a50c6748599cef4b34d2..74b269a93c1fa464a95bdae71074dba5ae9cf24d 100644
--- a/Source/core/inspector/NetworkResourcesData.cpp
+++ b/Source/core/inspector/NetworkResourcesData.cpp
@@ -157,15 +157,19 @@ void NetworkResourcesData::resourceCreated(const String& requestId, const String
static PassOwnPtr<TextResourceDecoder> createOtherResourceTextDecoder(const String& mimeType, const String& textEncodingName)
{
OwnPtr<TextResourceDecoder> decoder;
- if (!textEncodingName.isEmpty())
+ if (!textEncodingName.isEmpty()) {
decoder = TextResourceDecoder::create("text/plain", textEncodingName);
- else if (DOMImplementation::isXMLMIMEType(mimeType.lower())) {
- decoder = TextResourceDecoder::create("application/xml");
- decoder->useLenientXMLDecoding();
- } else if (equalIgnoringCase(mimeType, "text/html"))
- decoder = TextResourceDecoder::create("text/html", "UTF-8");
- else if (mimeType == "text/plain")
- decoder = TextResourceDecoder::create("text/plain", "ISO-8859-1");
+ } else {
+ String mimeTypeLower = mimeType.lower();
+ if (DOMImplementation::isXMLMIMEType(mimeTypeLower)) {
+ decoder = TextResourceDecoder::create("application/xml");
+ decoder->useLenientXMLDecoding();
+ } else if (equalIgnoringCase(mimeType, "text/html")) {
+ decoder = TextResourceDecoder::create("text/html", "UTF-8");
+ } else if (DOMImplementation::isTextMIMEType(mimeTypeLower)) {
+ decoder = TextResourceDecoder::create("text/plain", DOMImplementation::getTextDefaultEncodingName(mimeTypeLower));
+ }
+ }
return decoder.release();
}

Powered by Google App Engine
This is Rietveld 408576698