[Qt] Use the shared HistoryItem serialization for QWebHistory
authorjocelyn.turcotte@digia.com <jocelyn.turcotte@digia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 16 Jan 2013 15:06:46 +0000 (15:06 +0000)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Thu, 17 Jan 2013 16:36:03 +0000 (17:36 +0100)
commitf755a72b77240ed0cfac92f0355aa0464279db62
tree3a79aeebbb8231a0fd025a274be1ee488aba9530
parentdfa20637622bfadde8882afbf1e8b8500833b170
[Qt] Use the shared HistoryItem serialization for QWebHistory
https://bugs.webkit.org/show_bug.cgi?id=106671

Reviewed by Allan Sandfeld Jensen.

Source/WebCore:

This allows a few things missing from the previous serialization code
to function while using commonly maintained code:
- The itemSequenceNumber and documentSequenceNumber that were needed
  to properly restore same-document navigations
- The form data
- The navigation hierarchy mapping the frame tree

* history/HistoryItem.h:
(HistoryItem):
* history/qt/HistoryItemQt.cpp:
(QDataStreamCoder):
(WebCore):
(WebCore::QDataStreamCoder::QDataStreamCoder):
(WebCore::QDataStreamCoder::encodeBytes):
(WebCore::QDataStreamCoder::encodeBool):
(WebCore::QDataStreamCoder::encodeUInt32):
(WebCore::QDataStreamCoder::encodeUInt64):
(WebCore::QDataStreamCoder::encodeInt32):
(WebCore::QDataStreamCoder::encodeInt64):
(WebCore::QDataStreamCoder::encodeFloat):
(WebCore::QDataStreamCoder::encodeDouble):
(WebCore::QDataStreamCoder::encodeString):
(WebCore::QDataStreamCoder::decodeBytes):
(WebCore::QDataStreamCoder::decodeBool):
(WebCore::QDataStreamCoder::decodeUInt32):
(WebCore::QDataStreamCoder::decodeUInt64):
(WebCore::QDataStreamCoder::decodeInt32):
(WebCore::QDataStreamCoder::decodeInt64):
(WebCore::QDataStreamCoder::decodeFloat):
(WebCore::QDataStreamCoder::decodeDouble):
(WebCore::QDataStreamCoder::decodeString):
(WebCore::HistoryItem::restoreState):
(WebCore::WebCore::HistoryItem::saveState):

Source/WebKit/qt:

Bump the serialization version and change the code to abort the
restore of a previous stream version rather than trying to keep the
support of restoring previous versions. This is mainly to simplify
things given that HistoryItem itself aborts in that case.

* Api/qwebhistory.cpp:
(operator<<):
(operator>>):
* tests/qwebhistory/tst_qwebhistory.cpp:
(tst_QWebHistory::serialize_2): Modify the test to cover same-document navigations.
(tst_QWebHistory::restoreIncompatibleVersion1): Add a previous version
hard-coded stream to verify that the deserialization doesn't hang or
crash.

Change-Id: Ic3944179b7f1cb490722c38adbcfef88e8aa1c08
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@139878 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Reviewed-by: Jocelyn Turcotte <jocelyn.turcotte@digia.com>
Source/WebCore/ChangeLog
Source/WebCore/history/HistoryItem.h
Source/WebCore/history/qt/HistoryItemQt.cpp
Source/WebKit/qt/Api/qwebhistory.cpp
Source/WebKit/qt/ChangeLog
Source/WebKit/qt/tests/qwebhistory/tst_qwebhistory.cpp