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

Side by Side Diff: Source/core/inspector/NetworkResourcesData.cpp

Issue 122743002: MIME type predicates and case-insensitive matching. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Simplify check for empty +xml subtype Created 6 years, 11 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 unified diff | Download patch
« no previous file with comments | « Source/core/inspector/InspectorPageAgent.cpp ('k') | Source/core/xml/XMLHttpRequest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 10 *
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 { 153 {
154 ensureNoDataForRequestId(requestId); 154 ensureNoDataForRequestId(requestId);
155 m_requestIdToResourceDataMap.set(requestId, new ResourceData(requestId, load erId)); 155 m_requestIdToResourceDataMap.set(requestId, new ResourceData(requestId, load erId));
156 } 156 }
157 157
158 static PassOwnPtr<TextResourceDecoder> createOtherResourceTextDecoder(const Stri ng& mimeType, const String& textEncodingName) 158 static PassOwnPtr<TextResourceDecoder> createOtherResourceTextDecoder(const Stri ng& mimeType, const String& textEncodingName)
159 { 159 {
160 OwnPtr<TextResourceDecoder> decoder; 160 OwnPtr<TextResourceDecoder> decoder;
161 if (!textEncodingName.isEmpty()) { 161 if (!textEncodingName.isEmpty()) {
162 decoder = TextResourceDecoder::create("text/plain", textEncodingName); 162 decoder = TextResourceDecoder::create("text/plain", textEncodingName);
163 } else { 163 } else if (DOMImplementation::isXMLMIMEType(mimeType)) {
164 String mimeTypeLower = mimeType.lower(); 164 decoder = TextResourceDecoder::create("application/xml");
165 if (DOMImplementation::isXMLMIMEType(mimeTypeLower)) { 165 decoder->useLenientXMLDecoding();
166 decoder = TextResourceDecoder::create("application/xml"); 166 } else if (equalIgnoringCase(mimeType, "text/html")) {
167 decoder->useLenientXMLDecoding(); 167 decoder = TextResourceDecoder::create("text/html", "UTF-8");
168 } else if (equalIgnoringCase(mimeType, "text/html")) { 168 } else if (MIMETypeRegistry::isSupportedJavaScriptMIMEType(mimeType) || DOMI mplementation::isJSONMIMEType(mimeType)) {
169 decoder = TextResourceDecoder::create("text/html", "UTF-8"); 169 decoder = TextResourceDecoder::create("text/plain", "UTF-8");
170 } else if (MIMETypeRegistry::isSupportedJavaScriptMIMEType(mimeTypeLower ) || DOMImplementation::isJSONMIMEType(mimeTypeLower)) { 170 } else if (DOMImplementation::isTextMIMEType(mimeType)) {
171 decoder = TextResourceDecoder::create("text/plain", "UTF-8"); 171 decoder = TextResourceDecoder::create("text/plain", "ISO-8859-1");
172 } else if (DOMImplementation::isTextMIMEType(mimeTypeLower)) {
173 decoder = TextResourceDecoder::create("text/plain", "ISO-8859-1");
174 }
175 } 172 }
176 return decoder.release(); 173 return decoder.release();
177 } 174 }
178 175
179 void NetworkResourcesData::responseReceived(const String& requestId, const Strin g& frameId, const ResourceResponse& response) 176 void NetworkResourcesData::responseReceived(const String& requestId, const Strin g& frameId, const ResourceResponse& response)
180 { 177 {
181 ResourceData* resourceData = resourceDataForRequestId(requestId); 178 ResourceData* resourceData = resourceDataForRequestId(requestId);
182 if (!resourceData) 179 if (!resourceData)
183 return; 180 return;
184 resourceData->setFrameId(frameId); 181 resourceData->setFrameId(frameId);
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 String requestId = m_requestIdsDeque.takeFirst(); 392 String requestId = m_requestIdsDeque.takeFirst();
396 ResourceData* resourceData = resourceDataForRequestId(requestId); 393 ResourceData* resourceData = resourceDataForRequestId(requestId);
397 if (resourceData) 394 if (resourceData)
398 m_contentSize -= resourceData->evictContent(); 395 m_contentSize -= resourceData->evictContent();
399 } 396 }
400 return true; 397 return true;
401 } 398 }
402 399
403 } // namespace WebCore 400 } // namespace WebCore
404 401
OLDNEW
« no previous file with comments | « Source/core/inspector/InspectorPageAgent.cpp ('k') | Source/core/xml/XMLHttpRequest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698