Title: [186647] trunk/Source/WebCore
Revision
186647
Author
beid...@apple.com
Date
2015-07-09 16:29:33 -0700 (Thu, 09 Jul 2015)

Log Message

Add better ASSERTs to learn more about what is going wrong in DocumentLoader::detachFromFrame()
https://bugs.webkit.org/show_bug.cgi?id=146816

Reviewed by Alex Christensen.

* loader/DocumentLoader.cpp:
(WebCore::DocumentLoader::attachToFrame): Set the "has ever been attached" flag to true.
(WebCore::DocumentLoader::detachFromFrame): ASSERT m_frame is non-null, but with a message
  depending on the value of the "has ever been attached" flag.
* loader/DocumentLoader.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (186646 => 186647)


--- trunk/Source/WebCore/ChangeLog	2015-07-09 23:27:24 UTC (rev 186646)
+++ trunk/Source/WebCore/ChangeLog	2015-07-09 23:29:33 UTC (rev 186647)
@@ -1,3 +1,16 @@
+2015-07-09  Brady Eidson  <beid...@apple.com>
+
+        Add better ASSERTs to learn more about what is going wrong in DocumentLoader::detachFromFrame()
+        https://bugs.webkit.org/show_bug.cgi?id=146816
+
+        Reviewed by Alex Christensen.
+
+        * loader/DocumentLoader.cpp:
+        (WebCore::DocumentLoader::attachToFrame): Set the "has ever been attached" flag to true.
+        (WebCore::DocumentLoader::detachFromFrame): ASSERT m_frame is non-null, but with a message 
+          depending on the value of the "has ever been attached" flag.
+        * loader/DocumentLoader.h:
+
 2015-07-09  Brent Fulgham  <bfulg...@apple.com>
 
         [Mac, iOS] The mimeTypeCache should return a reference

Modified: trunk/Source/WebCore/loader/DocumentLoader.cpp (186646 => 186647)


--- trunk/Source/WebCore/loader/DocumentLoader.cpp	2015-07-09 23:27:24 UTC (rev 186646)
+++ trunk/Source/WebCore/loader/DocumentLoader.cpp	2015-07-09 23:29:33 UTC (rev 186647)
@@ -905,6 +905,10 @@
     m_frame = &frame;
     m_writer.setFrame(&frame);
     attachToFrame();
+
+#ifndef NDEBUG
+    m_hasEverBeenAttached = true;
+#endif
 }
 
 void DocumentLoader::attachToFrame()
@@ -914,7 +918,12 @@
 
 void DocumentLoader::detachFromFrame()
 {
-    ASSERT(m_frame);
+#ifndef NDEBUG
+    if (m_hasEverBeenAttached)
+        ASSERT_WITH_MESSAGE(m_frame, "detachFromFrame() is being called on a DocumentLoader twice without an attachToFrame() inbetween");
+    else
+        ASSERT_WITH_MESSAGE(m_frame, "detachFromFrame() is being called on a DocumentLoader that has never attached to any Frame");
+#endif
     RefPtr<Frame> protectFrame(m_frame);
     Ref<DocumentLoader> protectLoader(*this);
 

Modified: trunk/Source/WebCore/loader/DocumentLoader.h (186646 => 186647)


--- trunk/Source/WebCore/loader/DocumentLoader.h	2015-07-09 23:27:24 UTC (rev 186646)
+++ trunk/Source/WebCore/loader/DocumentLoader.h	2015-07-09 23:29:33 UTC (rev 186647)
@@ -448,6 +448,9 @@
         HashMap<String, std::pair<String, uint32_t>> m_pendingContentExtensionDisplayNoneSelectors;
 #endif
 
+#ifndef NDEBUG
+        bool m_hasEverBeenAttached { false }
+#endif
     };
 
     inline void DocumentLoader::recordMemoryCacheLoadForFutureClientNotification(const ResourceRequest& request)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to