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

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: Test via synthetic NetworkRequest 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
« no previous file with comments | « Source/core/dom/DOMImplementationTest.cpp ('k') | Source/devtools/front_end/RequestPreviewView.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/inspector/NetworkResourcesData.cpp
diff --git a/Source/core/inspector/NetworkResourcesData.cpp b/Source/core/inspector/NetworkResourcesData.cpp
index 3427421e4ac19dd97dae3109f4332539d708f223..60c2a8feec6f4f1492c842d4c58afce3fb38a49e 100644
--- a/Source/core/inspector/NetworkResourcesData.cpp
+++ b/Source/core/inspector/NetworkResourcesData.cpp
@@ -31,6 +31,7 @@
#include "core/dom/DOMImplementation.h"
#include "core/fetch/Resource.h"
+#include "platform/MIMETypeRegistry.h"
#include "platform/SharedBuffer.h"
#include "platform/network/ResourceResponse.h"
@@ -157,15 +158,21 @@ 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 (MIMETypeRegistry::isSupportedJavaScriptMIMEType(mimeTypeLower) || DOMImplementation::isJSONMIMEType(mimeTypeLower)) {
+ decoder = TextResourceDecoder::create("text/plain", "UTF-8");
+ } else if (DOMImplementation::isTextMIMEType(mimeTypeLower)) {
+ decoder = TextResourceDecoder::create("text/plain", "ISO-8859-1");
+ }
+ }
return decoder.release();
}
« no previous file with comments | « Source/core/dom/DOMImplementationTest.cpp ('k') | Source/devtools/front_end/RequestPreviewView.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698