Implement encoding of arrays of objects
[WebKit-https.git] / Source / WebCore / history / HistoryItem.cpp
index 6c7acd5508b86d1bc4af974643e594f022b45754..be51b62eca6ef35a199e2fe0577657dd7d50faf0 100644 (file)
@@ -737,7 +737,18 @@ void HistoryItem::encodeBackForwardTreeNode(Encoder& encoder) const
 
 void HistoryItem::encodeBackForwardTreeNode(KeyedEncoder& encoder) const
 {
-    // FIXME: Implement.
+    encoder.encodeObjects("children", m_children.begin(), m_children.end(), [](KeyedEncoder& encoder, const RefPtr<HistoryItem>& child) {
+        encoder.encodeString("originalURLString", child->m_originalURLString);
+        encoder.encodeString("urlString", child->m_urlString);
+
+        child->encodeBackForwardTreeNode(encoder);
+    });
+
+    encoder.encodeInt64("documentSequenceNumber", m_documentSequenceNumber);
+
+    encoder.encodeObjects("documentState", m_documentState.begin(), m_documentState.end(), [](KeyedEncoder& encoder, const String& string) {
+        encoder.encodeString("string", string);
+    });
 
     encoder.encodeString("formContentType", m_formContentType);
 
@@ -745,6 +756,8 @@ void HistoryItem::encodeBackForwardTreeNode(KeyedEncoder& encoder) const
         // FIXME: Implement.
     });
 
+    encoder.encodeInt64("itemSequenceNumber", m_itemSequenceNumber);
+
     encoder.encodeString("referrer", m_referrer);
 
     encoder.encodeObject("scrollPoint", m_scrollPoint, [](KeyedEncoder& encoder, const IntPoint& scrollPoint) {