Title: [246382] trunk/Source/WebKit
Revision
246382
Author
[email protected]
Date
2019-06-12 15:36:31 -0700 (Wed, 12 Jun 2019)

Log Message

Add assertions to help debug crash at WebKit::HistoryEntryDataEncoder::operator<<
https://bugs.webkit.org/show_bug.cgi?id=198766

Reviewed by Geoffrey Garen.

* Shared/SessionState.h:
(WebKit::FrameState::~FrameState):
* UIProcess/API/C/WKPage.cpp:
(WKPageCopySessionState):
* UIProcess/mac/LegacySessionStateCoding.cpp:
(WebKit::HistoryEntryDataEncoder::encodeFixedLengthData):
(WebKit::encodeFrameStateNode):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (246381 => 246382)


--- trunk/Source/WebKit/ChangeLog	2019-06-12 22:20:58 UTC (rev 246381)
+++ trunk/Source/WebKit/ChangeLog	2019-06-12 22:36:31 UTC (rev 246382)
@@ -1,3 +1,18 @@
+2019-06-12  Sihui Liu  <[email protected]>
+
+        Add assertions to help debug crash at WebKit::HistoryEntryDataEncoder::operator<<
+        https://bugs.webkit.org/show_bug.cgi?id=198766
+
+        Reviewed by Geoffrey Garen.
+
+        * Shared/SessionState.h:
+        (WebKit::FrameState::~FrameState):
+        * UIProcess/API/C/WKPage.cpp:
+        (WKPageCopySessionState):
+        * UIProcess/mac/LegacySessionStateCoding.cpp:
+        (WebKit::HistoryEntryDataEncoder::encodeFixedLengthData):
+        (WebKit::encodeFrameStateNode):
+
 2019-06-12  Ludovico de Nittis  <[email protected]>
 
         [GTK] GTK_STOCK_* types have been deprecated since GTK 3.10

Modified: trunk/Source/WebKit/Shared/SessionState.h (246381 => 246382)


--- trunk/Source/WebKit/Shared/SessionState.h	2019-06-12 22:20:58 UTC (rev 246381)
+++ trunk/Source/WebKit/Shared/SessionState.h	2019-06-12 22:36:31 UTC (rev 246382)
@@ -111,6 +111,10 @@
 #endif
 
     Vector<FrameState> children;
+
+    // This is only used to help debug <rdar://problem/48634553>.
+    bool isDestructed { false };
+    ~FrameState() { isDestructed = true; }
 };
 
 struct PageState {

Modified: trunk/Source/WebKit/UIProcess/API/C/WKPage.cpp (246381 => 246382)


--- trunk/Source/WebKit/UIProcess/API/C/WKPage.cpp	2019-06-12 22:20:58 UTC (rev 246381)
+++ trunk/Source/WebKit/UIProcess/API/C/WKPage.cpp	2019-06-12 22:36:31 UTC (rev 246382)
@@ -480,8 +480,9 @@
         return true;
     });
 
+    auto data = ""
     if (shouldReturnData)
-        return toAPI(encodeLegacySessionState(sessionState).leakRef());
+        return toAPI(data.leakRef());
 
     return toAPI(&API::SessionState::create(WTFMove(sessionState)).leakRef());
 }

Modified: trunk/Source/WebKit/UIProcess/mac/LegacySessionStateCoding.cpp (246381 => 246382)


--- trunk/Source/WebKit/UIProcess/mac/LegacySessionStateCoding.cpp	2019-06-12 22:20:58 UTC (rev 246381)
+++ trunk/Source/WebKit/UIProcess/mac/LegacySessionStateCoding.cpp	2019-06-12 22:36:31 UTC (rev 246382)
@@ -208,6 +208,7 @@
 
     void encodeFixedLengthData(const uint8_t* data, size_t size, unsigned alignment)
     {
+        RELEASE_ASSERT(data || !size);
         ASSERT(!(reinterpret_cast<uintptr_t>(data) % alignment));
 
         uint8_t* buffer = grow(alignment, size);
@@ -318,7 +319,9 @@
 {
     encoder << static_cast<uint64_t>(frameState.children.size());
 
+    RELEASE_ASSERT(!frameState.isDestructed);
     for (const auto& childFrameState : frameState.children) {
+        RELEASE_ASSERT(!childFrameState.isDestructed);
         encoder << childFrameState.originalURLString;
         encoder << childFrameState.urlString;
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to