WebCore:
2008-07-02 Brady Eidson <beidson@apple.com>
Reviewed by Mitz Pettel and John Sullivan
Fix for <rdar://problem/5549871> - Crash when calling [WebView stopLoading:] or [WebFrame stopLoading]
inside of the frame load delegate method -webView:didStartProvisionalLoadForFrame:.
Test: fast/loader/stop-provisional-loads.html
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::continueLoadAfterWillSubmitForm): Since the provisionalDocumentLoader may have been cleared
by the prepareForLoadStart() call, null check it again.
WebKitTools:
2008-07-02 Brady Eidson <beidson@apple.com>
Reviewed by Mitz Pettel and John Sullivan
Add the ability to tell DRT to call stopLoading on a WebFrame inside of a didStartProvisionalLoadForFrame
load delegate.
Required to add a layout test for the fix for <rdar://problem/5549871>
* DumpRenderTree/mac/FrameLoadDelegate.mm:
(-[FrameLoadDelegate webView:didStartProvisionalLoadForFrame:]): If stopProvisionalFrameLoads is set, call
[WebFrame stopLoading] to test for the crash reflected in 5549871
All of the following are infrastructure to add the layoutTestController.setStopProvisionalFrameLoads() call:
* DumpRenderTree/LayoutTestController.cpp:
(LayoutTestController::LayoutTestController):
(setStopProvisionalFrameLoadsCallback):
(LayoutTestController::staticFunctions):
* DumpRenderTree/LayoutTestController.h:
(LayoutTestController::stopProvisionalFrameLoads):
(LayoutTestController::setStopProvisionalFrameLoads):
LayoutTests:
2008-07-02 Brady Eidson <beidson@apple.com>
Reviewed by Mitz Pettel and John Sullivan
Fix for <rdar://problem/5549871> - Crash when calling [WebView stopLoading:] or [WebFrame stopLoading]
inside of the frame load delegate method -webView:didStartProvisionalLoadForFrame:.
* fast/loader/stop-provisional-loads-expected.txt: Added.
* fast/loader/stop-provisional-loads.html: Added.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@34972 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/loader/FrameLoader.cpp b/WebCore/loader/FrameLoader.cpp
index 32739bc..ce6bf8e 100644
--- a/WebCore/loader/FrameLoader.cpp
+++ b/WebCore/loader/FrameLoader.cpp
@@ -3137,6 +3137,11 @@
return;
m_provisionalDocumentLoader->prepareForLoadStart();
+
+ // The load might be cancelled inside of prepareForLoadStart(), nulling out the m_provisionalDocumentLoader,
+ // so we need to null check it again.
+ if (!m_provisionalDocumentLoader)
+ return;
DocumentLoader* activeDocLoader = activeDocumentLoader();
if (activeDocLoader && activeDocLoader->isLoadingMainResource())