| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2009 Apple Inc. All Rights Reserved. |
| 3 * Copyright (C) 2009, 2011 Google Inc. All Rights Reserved. | 3 * Copyright (C) 2009, 2011 Google Inc. All Rights Reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 if (response.httpStatusCode() / 100 != 2 && response.httpStatusCode()) { | 115 if (response.httpStatusCode() / 100 != 2 && response.httpStatusCode()) { |
| 116 m_failed = true; | 116 m_failed = true; |
| 117 return; | 117 return; |
| 118 } | 118 } |
| 119 m_responseURL = response.url(); | 119 m_responseURL = response.url(); |
| 120 m_responseEncoding = response.textEncodingName(); | 120 m_responseEncoding = response.textEncodingName(); |
| 121 if (m_client) | 121 if (m_client) |
| 122 m_client->didReceiveResponse(identifier, response); | 122 m_client->didReceiveResponse(identifier, response); |
| 123 } | 123 } |
| 124 | 124 |
| 125 void WorkerScriptLoader::didReceiveData(const char* data, int len) | 125 void WorkerScriptLoader::didReceiveData(const char* data, unsigned len) |
| 126 { | 126 { |
| 127 if (m_failed) | 127 if (m_failed) |
| 128 return; | 128 return; |
| 129 | 129 |
| 130 if (!m_decoder) { | 130 if (!m_decoder) { |
| 131 if (!m_responseEncoding.isEmpty()) | 131 if (!m_responseEncoding.isEmpty()) |
| 132 m_decoder = TextResourceDecoder::create("text/javascript", m_respons
eEncoding); | 132 m_decoder = TextResourceDecoder::create("text/javascript", m_respons
eEncoding); |
| 133 else | 133 else |
| 134 m_decoder = TextResourceDecoder::create("text/javascript", "UTF-8"); | 134 m_decoder = TextResourceDecoder::create("text/javascript", "UTF-8"); |
| 135 } | 135 } |
| 136 | 136 |
| 137 if (!len) | 137 if (!len) |
| 138 return; | 138 return; |
| 139 | 139 |
| 140 if (len == -1) | |
| 141 len = strlen(data); | |
| 142 | |
| 143 m_script.append(m_decoder->decode(data, len)); | 140 m_script.append(m_decoder->decode(data, len)); |
| 144 } | 141 } |
| 145 | 142 |
| 146 void WorkerScriptLoader::didFinishLoading(unsigned long identifier, double) | 143 void WorkerScriptLoader::didFinishLoading(unsigned long identifier, double) |
| 147 { | 144 { |
| 148 if (m_failed) { | 145 if (m_failed) { |
| 149 notifyError(); | 146 notifyError(); |
| 150 return; | 147 return; |
| 151 } | 148 } |
| 152 | 149 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 void WorkerScriptLoader::notifyFinished() | 184 void WorkerScriptLoader::notifyFinished() |
| 188 { | 185 { |
| 189 if (!m_client || m_finishing) | 186 if (!m_client || m_finishing) |
| 190 return; | 187 return; |
| 191 | 188 |
| 192 m_finishing = true; | 189 m_finishing = true; |
| 193 m_client->notifyFinished(); | 190 m_client->notifyFinished(); |
| 194 } | 191 } |
| 195 | 192 |
| 196 } // namespace blink | 193 } // namespace blink |
| OLD | NEW |