| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2011 Google Inc. All rights reserved. | 3 * Copyright (C) 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 * | 8 * |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 clearMainResourceLoader(); | 205 clearMainResourceLoader(); |
| 206 frameLoader()->receivedMainResourceError(error); | 206 frameLoader()->receivedMainResourceError(error); |
| 207 } | 207 } |
| 208 | 208 |
| 209 // Cancels the data source's pending loads. Conceptually, a data source only lo
ads | 209 // Cancels the data source's pending loads. Conceptually, a data source only lo
ads |
| 210 // one document at a time, but one document may have many related resources. | 210 // one document at a time, but one document may have many related resources. |
| 211 // stopLoading will stop all loads initiated by the data source, | 211 // stopLoading will stop all loads initiated by the data source, |
| 212 // but not loads initiated by child frames' data sources -- that's the WebFrame'
s job. | 212 // but not loads initiated by child frames' data sources -- that's the WebFrame'
s job. |
| 213 void DocumentLoader::stopLoading() | 213 void DocumentLoader::stopLoading() |
| 214 { | 214 { |
| 215 RefPtr<Frame> protectFrame(m_frame); |
| 216 RefPtr<DocumentLoader> protectLoader(this); |
| 217 |
| 215 // In some rare cases, calling FrameLoader::stopLoading could cause isLoadin
g() to return false. | 218 // In some rare cases, calling FrameLoader::stopLoading could cause isLoadin
g() to return false. |
| 216 // (This can happen when there's a single XMLHttpRequest currently loading a
nd stopLoading causes it | 219 // (This can happen when there's a single XMLHttpRequest currently loading a
nd stopLoading causes it |
| 217 // to stop loading. Because of this, we need to save it so we don't return e
arly. | 220 // to stop loading. Because of this, we need to save it so we don't return e
arly. |
| 218 bool loading = isLoading(); | 221 bool loading = isLoading(); |
| 219 | 222 |
| 220 if (m_committed) { | 223 if (m_committed) { |
| 221 // Attempt to stop the frame if the document loader is loading, or if it
is done loading but | 224 // Attempt to stop the frame if the document loader is loading, or if it
is done loading but |
| 222 // still parsing. Failure to do so can cause a world leak. | 225 // still parsing. Failure to do so can cause a world leak. |
| 223 Document* doc = m_frame->document(); | 226 Document* doc = m_frame->document(); |
| 224 | 227 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 241 // https://bugs.webkit.org/show_bug.cgi?id=62764 and <rdar://problem/932
8684> | 244 // https://bugs.webkit.org/show_bug.cgi?id=62764 and <rdar://problem/932
8684> |
| 242 ASSERT(!isLoading()); | 245 ASSERT(!isLoading()); |
| 243 return; | 246 return; |
| 244 } | 247 } |
| 245 | 248 |
| 246 // We might run in to infinite recursion if we're stopping loading as the re
sult of | 249 // We might run in to infinite recursion if we're stopping loading as the re
sult of |
| 247 // detaching from the frame, so break out of that recursion here. | 250 // detaching from the frame, so break out of that recursion here. |
| 248 // See <rdar://problem/9673866> for more details. | 251 // See <rdar://problem/9673866> for more details. |
| 249 if (m_isStopping) | 252 if (m_isStopping) |
| 250 return; | 253 return; |
| 251 | |
| 252 RefPtr<Frame> protectFrame(m_frame); | |
| 253 RefPtr<DocumentLoader> protectLoader(this); | |
| 254 | 254 |
| 255 m_isStopping = true; | 255 m_isStopping = true; |
| 256 | 256 |
| 257 FrameLoader* frameLoader = DocumentLoader::frameLoader(); | 257 FrameLoader* frameLoader = DocumentLoader::frameLoader(); |
| 258 | 258 |
| 259 if (m_mainResourceLoader) | 259 if (m_mainResourceLoader) |
| 260 // Stop the main resource loader and let it send the cancelled message. | 260 // Stop the main resource loader and let it send the cancelled message. |
| 261 m_mainResourceLoader->cancel(); | 261 m_mainResourceLoader->cancel(); |
| 262 else if (!m_subresourceLoaders.isEmpty()) | 262 else if (!m_subresourceLoaders.isEmpty()) |
| 263 // The main resource loader already finished loading. Set the cancelled
error on the | 263 // The main resource loader already finished loading. Set the cancelled
error on the |
| (...skipping 656 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 920 iconDatabase().iconDataForIconURL(urlString, m_iconDataCallback); | 920 iconDatabase().iconDataForIconURL(urlString, m_iconDataCallback); |
| 921 } | 921 } |
| 922 | 922 |
| 923 void DocumentLoader::handledOnloadEvents() | 923 void DocumentLoader::handledOnloadEvents() |
| 924 { | 924 { |
| 925 m_wasOnloadHandled = true; | 925 m_wasOnloadHandled = true; |
| 926 applicationCacheHost()->stopDeferringEvents(); | 926 applicationCacheHost()->stopDeferringEvents(); |
| 927 } | 927 } |
| 928 | 928 |
| 929 } // namespace WebCore | 929 } // namespace WebCore |
| OLD | NEW |