Title: [170395] trunk/Source/WebKit2
- Revision
- 170395
- Author
- ander...@apple.com
- Date
- 2014-06-24 15:32:33 -0700 (Tue, 24 Jun 2014)
Log Message
Add support for v0 legacy decoding
https://bugs.webkit.org/show_bug.cgi?id=134275
Reviewed by Andreas Kling.
* Shared/SessionState.h:
* UIProcess/mac/LegacySessionStateCoding.cpp:
(WebKit::LegacySessionStateDecoder::decodeV0SessionHistory):
(WebKit::LegacySessionStateDecoder::decodeV1SessionHistory):
Modified Paths
Diff
Modified: trunk/Source/WebKit2/ChangeLog (170394 => 170395)
--- trunk/Source/WebKit2/ChangeLog 2014-06-24 22:24:23 UTC (rev 170394)
+++ trunk/Source/WebKit2/ChangeLog 2014-06-24 22:32:33 UTC (rev 170395)
@@ -1,5 +1,17 @@
2014-06-24 Anders Carlsson <ander...@apple.com>
+ Add support for v0 legacy decoding
+ https://bugs.webkit.org/show_bug.cgi?id=134275
+
+ Reviewed by Andreas Kling.
+
+ * Shared/SessionState.h:
+ * UIProcess/mac/LegacySessionStateCoding.cpp:
+ (WebKit::LegacySessionStateDecoder::decodeV0SessionHistory):
+ (WebKit::LegacySessionStateDecoder::decodeV1SessionHistory):
+
+2014-06-24 Anders Carlsson <ander...@apple.com>
+
Add SPI for clearing an entire back-forward list
https://bugs.webkit.org/show_bug.cgi?id=134274
Modified: trunk/Source/WebKit2/Shared/SessionState.h (170394 => 170395)
--- trunk/Source/WebKit2/Shared/SessionState.h 2014-06-24 22:24:23 UTC (rev 170394)
+++ trunk/Source/WebKit2/Shared/SessionState.h 2014-06-24 22:32:33 UTC (rev 170395)
@@ -118,7 +118,7 @@
static bool decode(IPC::ArgumentDecoder&, BackForwardListState&);
Vector<PageState> items;
- uint32_t currentIndex;
+ Optional<uint32_t> currentIndex;
};
struct SessionState {
Modified: trunk/Source/WebKit2/UIProcess/mac/LegacySessionStateCoding.cpp (170394 => 170395)
--- trunk/Source/WebKit2/UIProcess/mac/LegacySessionStateCoding.cpp 2014-06-24 22:24:23 UTC (rev 170394)
+++ trunk/Source/WebKit2/UIProcess/mac/LegacySessionStateCoding.cpp 2014-06-24 22:32:33 UTC (rev 170395)
@@ -118,8 +118,38 @@
bool LegacySessionStateDecoder::decodeV0SessionHistory(CFDictionaryRef sessionHistoryDictionary, BackForwardListState& backForwardListState) const
{
- // FIXME: Implement.
- return false;
+ auto currentIndexNumber = dynamic_cf_cast<CFNumberRef>(CFDictionaryGetValue(sessionHistoryDictionary, sessionHistoryCurrentIndexKey));
+ if (!currentIndexNumber)
+ return false;
+
+ CFIndex currentIndex;
+ if (!CFNumberGetValue(currentIndexNumber, kCFNumberCFIndexType, ¤tIndex))
+ return false;
+
+ if (currentIndex < -1)
+ return false;
+
+ auto historyEntries = dynamic_cf_cast<CFArrayRef>(CFDictionaryGetValue(sessionHistoryDictionary, sessionHistoryEntriesKey));
+ if (!historyEntries)
+ return false;
+
+ // Version 0 session history relied on currentIndex == -1 to represent the same thing as not having a current index.
+ bool hasCurrentIndex = currentIndex != -1;
+
+ if (!decodeSessionHistoryEntries(historyEntries, backForwardListState.items))
+ return false;
+
+ if (!hasCurrentIndex && CFArrayGetCount(historyEntries))
+ return false;
+
+ if (hasCurrentIndex) {
+ if (static_cast<uint32_t>(currentIndex) >= backForwardListState.items.size())
+ return false;
+
+ backForwardListState.currentIndex = static_cast<uint32_t>(currentIndex);
+ }
+
+ return true;
}
bool LegacySessionStateDecoder::decodeV1SessionHistory(CFDictionaryRef sessionHistoryDictionary, BackForwardListState& backForwardListState) const
@@ -147,7 +177,7 @@
return false;
backForwardListState.currentIndex = static_cast<uint32_t>(currentIndex);
- if (backForwardListState.currentIndex >= backForwardListState.items.size())
+ if (static_cast<uint32_t>(currentIndex) >= backForwardListState.items.size())
return false;
return true;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes