#include "core/dom/DOMImplementation.h"
#include "core/fetch/Resource.h"
-#include "platform/MIMETypeRegistry.h"
#include "platform/SharedBuffer.h"
#include "platform/network/ResourceResponse.h"
m_requestIdToResourceDataMap.set(requestId, new ResourceData(requestId, loaderId));
}
-static PassOwnPtr<TextResourceDecoder> createOtherResourceTextDecoder(const String& mimeType, const String& textEncodingName)
-{
- OwnPtr<TextResourceDecoder> decoder;
- if (!textEncodingName.isEmpty()) {
- decoder = TextResourceDecoder::create("text/plain", textEncodingName);
- } else if (DOMImplementation::isXMLMIMEType(mimeType)) {
- decoder = TextResourceDecoder::create("application/xml");
- decoder->useLenientXMLDecoding();
- } else if (equalIgnoringCase(mimeType, "text/html")) {
- decoder = TextResourceDecoder::create("text/html", "UTF-8");
- } else if (MIMETypeRegistry::isSupportedJavaScriptMIMEType(mimeType) || DOMImplementation::isJSONMIMEType(mimeType)) {
- decoder = TextResourceDecoder::create("text/plain", "UTF-8");
- } else if (DOMImplementation::isTextMIMEType(mimeType)) {
- decoder = TextResourceDecoder::create("text/plain", "ISO-8859-1");
- }
- return decoder.release();
-}
-
void NetworkResourcesData::responseReceived(const String& requestId, const String& frameId, const ResourceResponse& response)
{
ResourceData* resourceData = resourceDataForRequestId(requestId);
return;
resourceData->setFrameId(frameId);
resourceData->setUrl(response.url());
- resourceData->setDecoder(createOtherResourceTextDecoder(response.mimeType(), response.textEncodingName()));
+ resourceData->setDecoder(InspectorPageAgent::createResourceTextDecoder(response.mimeType(), response.textEncodingName()));
resourceData->setHTTPStatusCode(response.httpStatusCode());
}