| OLD | NEW |
| 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 * * Redistributions of source code must retain the above copyright | 8 * * 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 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 bool useDetector = false; | 110 bool useDetector = false; |
| 111 if (!textEncoding.isValid()) { | 111 if (!textEncoding.isValid()) { |
| 112 textEncoding = UTF8Encoding(); | 112 textEncoding = UTF8Encoding(); |
| 113 useDetector = true; | 113 useDetector = true; |
| 114 } | 114 } |
| 115 m_decoder = TextResourceDecoder::create("text/plain", textEncoding, useD
etector); | 115 m_decoder = TextResourceDecoder::create("text/plain", textEncoding, useD
etector); |
| 116 m_statusCode = response.httpStatusCode(); | 116 m_statusCode = response.httpStatusCode(); |
| 117 m_responseHeaders = response.httpHeaderFields(); | 117 m_responseHeaders = response.httpHeaderFields(); |
| 118 } | 118 } |
| 119 | 119 |
| 120 virtual void didReceiveData(const char* data, int dataLength) OVERRIDE | 120 virtual void didReceiveData(const char* data, unsigned dataLength) OVERRIDE |
| 121 { | 121 { |
| 122 if (!dataLength) | 122 if (!dataLength) |
| 123 return; | 123 return; |
| 124 | 124 |
| 125 if (dataLength == -1) | |
| 126 dataLength = strlen(data); | |
| 127 | |
| 128 m_responseText = m_responseText.concatenateWith(m_decoder->decode(data,
dataLength)); | 125 m_responseText = m_responseText.concatenateWith(m_decoder->decode(data,
dataLength)); |
| 129 } | 126 } |
| 130 | 127 |
| 131 virtual void didFinishLoading(unsigned long /*identifier*/, double /*finishT
ime*/) OVERRIDE | 128 virtual void didFinishLoading(unsigned long /*identifier*/, double /*finishT
ime*/) OVERRIDE |
| 132 { | 129 { |
| 133 if (m_decoder) | 130 if (m_decoder) |
| 134 m_responseText = m_responseText.concatenateWith(m_decoder->flush()); | 131 m_responseText = m_responseText.concatenateWith(m_decoder->flush()); |
| 135 m_callback->sendSuccess(m_statusCode, buildObjectForHeaders(m_responseHe
aders), m_responseText.flattenToString()); | 132 m_callback->sendSuccess(m_statusCode, buildObjectForHeaders(m_responseHe
aders), m_responseText.flattenToString()); |
| 136 dispose(); | 133 dispose(); |
| 137 } | 134 } |
| (...skipping 750 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 888 , m_removeFinishedReplayXHRTimer(this, &InspectorResourceAgent::removeFinish
edReplayXHRFired) | 885 , m_removeFinishedReplayXHRTimer(this, &InspectorResourceAgent::removeFinish
edReplayXHRFired) |
| 889 { | 886 { |
| 890 } | 887 } |
| 891 | 888 |
| 892 bool InspectorResourceAgent::shouldForceCORSPreflight() | 889 bool InspectorResourceAgent::shouldForceCORSPreflight() |
| 893 { | 890 { |
| 894 return m_state->getBoolean(ResourceAgentState::cacheDisabled); | 891 return m_state->getBoolean(ResourceAgentState::cacheDisabled); |
| 895 } | 892 } |
| 896 | 893 |
| 897 } // namespace blink | 894 } // namespace blink |
| OLD | NEW |