OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 | 154 |
155 static void delayedAbort(ScriptExecutionContext*, FileReader* reader) | 155 static void delayedAbort(ScriptExecutionContext*, FileReader* reader) |
156 { | 156 { |
157 reader->doAbort(); | 157 reader->doAbort(); |
158 } | 158 } |
159 | 159 |
160 void FileReader::abort() | 160 void FileReader::abort() |
161 { | 161 { |
162 LOG(FileAPI, "FileReader: aborting\n"); | 162 LOG(FileAPI, "FileReader: aborting\n"); |
163 | 163 |
164 if (m_aborting) | 164 if (m_aborting || m_state != LOADING) |
165 return; | 165 return; |
166 m_aborting = true; | 166 m_aborting = true; |
167 | 167 |
168 // Schedule to have the abort done later since abort() might be called from
the event handler and we do not want the resource loading code to be in the stac
k. | 168 // Schedule to have the abort done later since abort() might be called from
the event handler and we do not want the resource loading code to be in the stac
k. |
169 scriptExecutionContext()->postTask( | 169 scriptExecutionContext()->postTask( |
170 createCallbackTask(&delayedAbort, AllowAccessLater(this))); | 170 createCallbackTask(&delayedAbort, AllowAccessLater(this))); |
171 } | 171 } |
172 | 172 |
173 void FileReader::doAbort() | 173 void FileReader::doAbort() |
174 { | 174 { |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 String FileReader::stringResult() | 258 String FileReader::stringResult() |
259 { | 259 { |
260 if (!m_loader || m_error) | 260 if (!m_loader || m_error) |
261 return String(); | 261 return String(); |
262 return m_loader->stringResult(); | 262 return m_loader->stringResult(); |
263 } | 263 } |
264 | 264 |
265 } // namespace WebCore | 265 } // namespace WebCore |
266 | 266 |
267 #endif // ENABLE(BLOB) | 267 #endif // ENABLE(BLOB) |
OLD | NEW |