Protect this DocumentThreadableLoader in cancel() to handle reentrancy properly.
authorjaphet@chromium.org <japhet@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 3 Jul 2012 21:37:28 +0000 (21:37 +0000)
committerjaphet@chromium.org <japhet@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 3 Jul 2012 21:37:28 +0000 (21:37 +0000)
https://bugs.webkit.org/show_bug.cgi?id=90483

Reviewed by Abhishek Arya.

No new tests, covered by http/tests/xmlhttprequest/reentrant-cancel.html

* loader/DocumentThreadableLoader.cpp:
(WebCore::DocumentThreadableLoader::cancel):

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

Source/WebCore/ChangeLog
Source/WebCore/loader/DocumentThreadableLoader.cpp

index 62e3152..d4b6b31 100644 (file)
@@ -1,3 +1,15 @@
+2012-07-03  Nate Chapin  <japhet@chromium.org>
+
+        Protect this DocumentThreadableLoader in cancel() to handle reentrancy properly.
+        https://bugs.webkit.org/show_bug.cgi?id=90483
+
+        Reviewed by Abhishek Arya.
+
+        No new tests, covered by http/tests/xmlhttprequest/reentrant-cancel.html
+
+        * loader/DocumentThreadableLoader.cpp:
+        (WebCore::DocumentThreadableLoader::cancel):
+
 2012-07-03  Tony Chang  <tony@chromium.org>
 
         [chromium] Unreviewed, update .gitignore to handle VS2010 files.
index aeb4c69..56609a6 100644 (file)
@@ -146,7 +146,9 @@ DocumentThreadableLoader::~DocumentThreadableLoader()
 
 void DocumentThreadableLoader::cancel()
 {
-    // Cacnel can re-enter and m_resource might be null here as a result.
+    RefPtr<DocumentThreadableLoader> protect(this);
+
+    // Cancel can re-enter and m_resource might be null here as a result.
     if (m_client && m_resource) {
         ResourceError error(errorDomainWebKitInternal, 0, m_resource->url(), "Load cancelled");
         error.setIsCancellation(true);