Work towards determining the cause of frequent crashes due to null frame below
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 16 Jul 2011 22:39:31 +0000 (22:39 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 16 Jul 2011 22:39:31 +0000 (22:39 +0000)
ApplicationCacheHost::scheduleLoadFallbackResourceFromApplicationCache.
https://bugs.webkit.org/show_bug.cgi?id=62764

Patch by Jessie Berlin <jberlin@apple.com> on 2011-07-16
Reviewed by Darin Adler.

No loads should be going on for a DocumentLoader that has been detached from its frame, but
that appears to be what is happening in this bug.

Add assertions with the hope that someone will run into this while debugging and thereby find
a reproducible case.

* loader/ResourceLoader.cpp:
(WebCore::ResourceLoader::willSendRequest):
(WebCore::ResourceLoader::didSendData):
(WebCore::ResourceLoader::didReceiveResponse):
(WebCore::ResourceLoader::didReceiveData):
(WebCore::ResourceLoader::didFinishLoading):
(WebCore::ResourceLoader::didFail):
(WebCore::ResourceLoader::wasBlocked):
(WebCore::ResourceLoader::cannotShowURL):
(WebCore::ResourceLoader::shouldUseCredentialStorage):
(WebCore::ResourceLoader::willCacheResponse):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@91153 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/loader/ResourceLoader.cpp

index 0329377..1ecc15f 100644 (file)
@@ -1,3 +1,29 @@
+2011-07-16  Jessie Berlin  <jberlin@apple.com>
+
+        Work towards determining the cause of frequent crashes due to null frame below
+        ApplicationCacheHost::scheduleLoadFallbackResourceFromApplicationCache.
+        https://bugs.webkit.org/show_bug.cgi?id=62764
+
+        Reviewed by Darin Adler.
+
+        No loads should be going on for a DocumentLoader that has been detached from its frame, but
+        that appears to be what is happening in this bug.
+
+        Add assertions with the hope that someone will run into this while debugging and thereby find
+        a reproducible case.
+
+        * loader/ResourceLoader.cpp:
+        (WebCore::ResourceLoader::willSendRequest):
+        (WebCore::ResourceLoader::didSendData):
+        (WebCore::ResourceLoader::didReceiveResponse):
+        (WebCore::ResourceLoader::didReceiveData):
+        (WebCore::ResourceLoader::didFinishLoading):
+        (WebCore::ResourceLoader::didFail):
+        (WebCore::ResourceLoader::wasBlocked):
+        (WebCore::ResourceLoader::cannotShowURL):
+        (WebCore::ResourceLoader::shouldUseCredentialStorage):
+        (WebCore::ResourceLoader::willCacheResponse):
+
 2011-07-16  Sergey Glazunov  <serg.glazunov@gmail.com>
 
         DOMWindow::open performs a security check on a wrong window
index f92a6d5..15ccc94 100644 (file)
@@ -224,6 +224,7 @@ void ResourceLoader::clearResourceData()
 
 void ResourceLoader::willSendRequest(ResourceRequest& request, const ResourceResponse& redirectResponse)
 {
+    ASSERT(documentLoader()->frame());
     // Protect this in this delegate method since the additional processing can do
     // anything including possibly derefing this; one example of this is Radar 3266216.
     RefPtr<ResourceLoader> protector(this);
@@ -246,10 +247,12 @@ void ResourceLoader::willSendRequest(ResourceRequest& request, const ResourceRes
 
 void ResourceLoader::didSendData(unsigned long long, unsigned long long)
 {
+    ASSERT(documentLoader()->frame());
 }
 
 void ResourceLoader::didReceiveResponse(const ResourceResponse& r)
 {
+    ASSERT(documentLoader()->frame());
     ASSERT(!m_reachedTerminalState);
 
     // Protect this in this delegate method since the additional processing can do
@@ -267,6 +270,7 @@ void ResourceLoader::didReceiveResponse(const ResourceResponse& r)
 
 void ResourceLoader::didReceiveData(const char* data, int length, long long encodedDataLength, bool allAtOnce)
 {
+    ASSERT(documentLoader()->frame());
     // The following assertions are not quite valid here, since a subclass
     // might override didReceiveData in a way that invalidates them. This
     // happens with the steps listed in 3266216
@@ -441,11 +445,13 @@ void ResourceLoader::didReceiveData(ResourceHandle*, const char* data, int lengt
 
 void ResourceLoader::didFinishLoading(ResourceHandle*, double finishTime)
 {
+    ASSERT(documentLoader()->frame());
     didFinishLoading(finishTime);
 }
 
 void ResourceLoader::didFail(ResourceHandle*, const ResourceError& error)
 {
+    ASSERT(documentLoader()->frame());
 #if ENABLE(OFFLINE_WEB_APPLICATIONS)
     if (documentLoader()->applicationCacheHost()->maybeLoadFallbackForError(this, error))
         return;
@@ -455,16 +461,19 @@ void ResourceLoader::didFail(ResourceHandle*, const ResourceError& error)
 
 void ResourceLoader::wasBlocked(ResourceHandle*)
 {
+    ASSERT(documentLoader()->frame());
     didFail(blockedError());
 }
 
 void ResourceLoader::cannotShowURL(ResourceHandle*)
 {
+    ASSERT(documentLoader()->frame());
     didFail(cannotShowURLError());
 }
 
 bool ResourceLoader::shouldUseCredentialStorage()
 {
+    ASSERT(documentLoader()->frame());
     RefPtr<ResourceLoader> protector(this);
     return frameLoader()->client()->shouldUseCredentialStorage(documentLoader(), identifier());
 }
@@ -500,6 +509,7 @@ void ResourceLoader::receivedCancellation(const AuthenticationChallenge&)
 
 void ResourceLoader::willCacheResponse(ResourceHandle*, CacheStoragePolicy& policy)
 {
+    ASSERT(documentLoader()->frame());
     // <rdar://problem/7249553> - There are reports of crashes with this method being called
     // with a null m_frame->settings(), which can only happen if the frame doesn't have a page.
     // Sadly we have no reproducible cases of this.