| 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 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 |
| 11 * notice, this list of conditions and the following disclaimer in the | 11 * notice, this list of conditions and the following disclaimer in the |
| 12 * documentation and/or other materials provided with the distribution. | 12 * documentation and/or other materials provided with the distribution. |
| 13 * | 13 * |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 return; | 80 return; |
| 81 | 81 |
| 82 ThreadableLoaderOptions options; | 82 ThreadableLoaderOptions options; |
| 83 options.allowCredentials = true; | 83 options.allowCredentials = true; |
| 84 options.crossOriginRequestPolicy = crossOriginRequestPolicy; | 84 options.crossOriginRequestPolicy = crossOriginRequestPolicy; |
| 85 options.sendLoadCallbacks = true; | 85 options.sendLoadCallbacks = true; |
| 86 | 86 |
| 87 m_threadableLoader = ThreadableLoader::create(scriptExecutionContext, this,
*request, options); | 87 m_threadableLoader = ThreadableLoader::create(scriptExecutionContext, this,
*request, options); |
| 88 } | 88 } |
| 89 | 89 |
| 90 const KURL& WorkerScriptLoader::responseURL() const |
| 91 { |
| 92 ASSERT(!failed()); |
| 93 return m_responseURL; |
| 94 } |
| 95 |
| 90 PassOwnPtr<ResourceRequest> WorkerScriptLoader::createResourceRequest() | 96 PassOwnPtr<ResourceRequest> WorkerScriptLoader::createResourceRequest() |
| 91 { | 97 { |
| 92 OwnPtr<ResourceRequest> request(new ResourceRequest(m_url)); | 98 OwnPtr<ResourceRequest> request(new ResourceRequest(m_url)); |
| 93 request->setHTTPMethod("GET"); | 99 request->setHTTPMethod("GET"); |
| 94 request->setTargetType(m_targetType); | 100 request->setTargetType(m_targetType); |
| 95 return request.release(); | 101 return request.release(); |
| 96 } | 102 } |
| 97 | 103 |
| 98 void WorkerScriptLoader::didReceiveResponse(const ResourceResponse& response) | 104 void WorkerScriptLoader::didReceiveResponse(const ResourceResponse& response) |
| 99 { | 105 { |
| 100 if (response.httpStatusCode() / 100 != 2 && response.httpStatusCode()) { | 106 if (response.httpStatusCode() / 100 != 2 && response.httpStatusCode()) { |
| 101 m_failed = true; | 107 m_failed = true; |
| 102 return; | 108 return; |
| 103 } | 109 } |
| 110 m_responseURL = response.url(); |
| 104 m_responseEncoding = response.textEncodingName(); | 111 m_responseEncoding = response.textEncodingName(); |
| 105 if (m_client) | 112 if (m_client) |
| 106 m_client->didReceiveResponse(response); | 113 m_client->didReceiveResponse(response); |
| 107 } | 114 } |
| 108 | 115 |
| 109 void WorkerScriptLoader::didReceiveData(const char* data, int len) | 116 void WorkerScriptLoader::didReceiveData(const char* data, int len) |
| 110 { | 117 { |
| 111 if (m_failed) | 118 if (m_failed) |
| 112 return; | 119 return; |
| 113 | 120 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 | 169 |
| 163 void WorkerScriptLoader::notifyFinished() | 170 void WorkerScriptLoader::notifyFinished() |
| 164 { | 171 { |
| 165 if (m_client) | 172 if (m_client) |
| 166 m_client->notifyFinished(); | 173 m_client->notifyFinished(); |
| 167 } | 174 } |
| 168 | 175 |
| 169 } // namespace WebCore | 176 } // namespace WebCore |
| 170 | 177 |
| 171 #endif // ENABLE(WORKERS) | 178 #endif // ENABLE(WORKERS) |
| OLD | NEW |