Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(300)

Side by Side Diff: Source/WebCore/loader/DocumentLoader.cpp

Issue 11819066: Merge 138926 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1364/
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/WebCore/html/parser/HTMLDocumentParser.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 clearMainResourceLoader(); 201 clearMainResourceLoader();
202 frameLoader()->receivedMainResourceError(error); 202 frameLoader()->receivedMainResourceError(error);
203 } 203 }
204 204
205 // Cancels the data source's pending loads. Conceptually, a data source only lo ads 205 // Cancels the data source's pending loads. Conceptually, a data source only lo ads
206 // one document at a time, but one document may have many related resources. 206 // one document at a time, but one document may have many related resources.
207 // stopLoading will stop all loads initiated by the data source, 207 // stopLoading will stop all loads initiated by the data source,
208 // but not loads initiated by child frames' data sources -- that's the WebFrame' s job. 208 // but not loads initiated by child frames' data sources -- that's the WebFrame' s job.
209 void DocumentLoader::stopLoading() 209 void DocumentLoader::stopLoading()
210 { 210 {
211 RefPtr<Frame> protectFrame(m_frame);
212 RefPtr<DocumentLoader> protectLoader(this);
213
211 // In some rare cases, calling FrameLoader::stopLoading could cause isLoadin g() to return false. 214 // In some rare cases, calling FrameLoader::stopLoading could cause isLoadin g() to return false.
212 // (This can happen when there's a single XMLHttpRequest currently loading a nd stopLoading causes it 215 // (This can happen when there's a single XMLHttpRequest currently loading a nd stopLoading causes it
213 // to stop loading. Because of this, we need to save it so we don't return e arly. 216 // to stop loading. Because of this, we need to save it so we don't return e arly.
214 bool loading = isLoading(); 217 bool loading = isLoading();
215 218
216 if (m_committed) { 219 if (m_committed) {
217 // Attempt to stop the frame if the document loader is loading, or if it is done loading but 220 // Attempt to stop the frame if the document loader is loading, or if it is done loading but
218 // still parsing. Failure to do so can cause a world leak. 221 // still parsing. Failure to do so can cause a world leak.
219 Document* doc = m_frame->document(); 222 Document* doc = m_frame->document();
220 223
(...skipping 16 matching lines...) Expand all
237 // https://bugs.webkit.org/show_bug.cgi?id=62764 and <rdar://problem/932 8684> 240 // https://bugs.webkit.org/show_bug.cgi?id=62764 and <rdar://problem/932 8684>
238 ASSERT(!isLoading()); 241 ASSERT(!isLoading());
239 return; 242 return;
240 } 243 }
241 244
242 // We might run in to infinite recursion if we're stopping loading as the re sult of 245 // We might run in to infinite recursion if we're stopping loading as the re sult of
243 // detaching from the frame, so break out of that recursion here. 246 // detaching from the frame, so break out of that recursion here.
244 // See <rdar://problem/9673866> for more details. 247 // See <rdar://problem/9673866> for more details.
245 if (m_isStopping) 248 if (m_isStopping)
246 return; 249 return;
247
248 RefPtr<Frame> protectFrame(m_frame);
249 RefPtr<DocumentLoader> protectLoader(this);
250 250
251 m_isStopping = true; 251 m_isStopping = true;
252 252
253 FrameLoader* frameLoader = DocumentLoader::frameLoader(); 253 FrameLoader* frameLoader = DocumentLoader::frameLoader();
254 254
255 if (m_mainResourceLoader) 255 if (m_mainResourceLoader)
256 // Stop the main resource loader and let it send the cancelled message. 256 // Stop the main resource loader and let it send the cancelled message.
257 m_mainResourceLoader->cancel(); 257 m_mainResourceLoader->cancel();
258 else if (!m_subresourceLoaders.isEmpty()) 258 else if (!m_subresourceLoaders.isEmpty())
259 // The main resource loader already finished loading. Set the cancelled error on the 259 // The main resource loader already finished loading. Set the cancelled error on the
(...skipping 702 matching lines...) Expand 10 before | Expand all | Expand 10 after
962 iconDatabase().iconDataForIconURL(urlString, m_iconDataCallback); 962 iconDatabase().iconDataForIconURL(urlString, m_iconDataCallback);
963 } 963 }
964 964
965 void DocumentLoader::handledOnloadEvents() 965 void DocumentLoader::handledOnloadEvents()
966 { 966 {
967 m_wasOnloadHandled = true; 967 m_wasOnloadHandled = true;
968 applicationCacheHost()->stopDeferringEvents(); 968 applicationCacheHost()->stopDeferringEvents();
969 } 969 }
970 970
971 } // namespace WebCore 971 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/WebCore/html/parser/HTMLDocumentParser.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698