[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

beidson at apple.com beidson at apple.com
Wed Dec 22 14:30:03 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit bb2dec68816146da316399d06bdc4c4f2c656d4d
Author: beidson at apple.com <beidson at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Oct 12 00:01:53 2010 +0000

    <rdar://problem/8262202> and https://bugs.webkit.org/show_bug.cgi?id=47354
    Need WKPage API for serializing and restoring a page's state
    
    Reviewed by Darin Adler and Sam Weinig.
    
    * WebKit2.xcodeproj/project.pbxproj:
    * win/WebKit2.vcproj:
    
    * WebKit2Prefix.h: Add DEFINE_STATIC_GETTER convenience.
    
    * UIProcess/API/C/WKPage.cpp:
    (WKPageGetSessionHistoryURLValueType):
    (WKPageCopySessionState): Change to use a filter function to allow the API client to decide what
      types of things get serialized as session state.  For now it only filters based on URL in
      session history entries.
    (WKPageRestoreFromSessionState):
    * UIProcess/API/C/WKPage.h:
    
    * UIProcess/WebBackForwardList.h:
    (WebKit::WebBackForwardList::restoredCurrentURL):
    
    * UIProcess/WebPageProxy.cpp:
    (WebKit::WebPageProxy::sessionStateData): Leave stubs for non-CF platform builds.
    (WebKit::WebPageProxy::restoreFromSessionStateData): Ditto.
    * UIProcess/WebPageProxy.h:
    
    * UIProcess/cf: Added.
    * UIProcess/cf/WebBackForwardListCF.cpp: Added.
    (WebKit::WebBackForwardList::createCFDictionaryRepresentation): Store back/forward list info CF property list style.
    (WebKit::WebBackForwardList::restoreFromCFDictionaryRepresentation): Restore from that data - but for now we don't
      actually put the back/forward list back into place and instead only remember the current URL.
    
    * UIProcess/cf/WebPageProxyCF.cpp: Added.
    (WebKit::WebPageProxy::sessionStateData): Create the sessions state date CF property list style, plus a version header.
    (WebKit::WebPageProxy::restoreFromSessionStateData): Restore from that property list style session state data.
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@69538 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index 28bc837..4df2196 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -1,3 +1,41 @@
+2010-10-11  Brady Eidson  <beidson at apple.com>
+
+        Reviewed by Darin Adler and Sam Weinig.
+
+        <rdar://problem/8262202> and https://bugs.webkit.org/show_bug.cgi?id=47354
+        Need WKPage API for serializing and restoring a page's state
+
+        * WebKit2.xcodeproj/project.pbxproj:
+        * win/WebKit2.vcproj:
+
+        * WebKit2Prefix.h: Add DEFINE_STATIC_GETTER convenience.
+
+        * UIProcess/API/C/WKPage.cpp:
+        (WKPageGetSessionHistoryURLValueType):
+        (WKPageCopySessionState): Change to use a filter function to allow the API client to decide what
+          types of things get serialized as session state.  For now it only filters based on URL in
+          session history entries.
+        (WKPageRestoreFromSessionState):
+        * UIProcess/API/C/WKPage.h:
+
+        * UIProcess/WebBackForwardList.h:
+        (WebKit::WebBackForwardList::restoredCurrentURL):
+
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::sessionStateData): Leave stubs for non-CF platform builds.
+        (WebKit::WebPageProxy::restoreFromSessionStateData): Ditto.
+        * UIProcess/WebPageProxy.h:
+
+        * UIProcess/cf: Added.
+        * UIProcess/cf/WebBackForwardListCF.cpp: Added.
+        (WebKit::WebBackForwardList::createCFDictionaryRepresentation): Store back/forward list info CF property list style.
+        (WebKit::WebBackForwardList::restoreFromCFDictionaryRepresentation): Restore from that data - but for now we don't 
+          actually put the back/forward list back into place and instead only remember the current URL.
+
+        * UIProcess/cf/WebPageProxyCF.cpp: Added.
+        (WebKit::WebPageProxy::sessionStateData): Create the sessions state date CF property list style, plus a version header.
+        (WebKit::WebPageProxy::restoreFromSessionStateData): Restore from that property list style session state data.
+
 2010-10-11  Adam Roben  <aroben at apple.com>
 
         Implement SharedMemory on Windows
diff --git a/WebKit2/UIProcess/API/C/WKPage.cpp b/WebKit2/UIProcess/API/C/WKPage.cpp
index acd2dad..469d753 100644
--- a/WebKit2/UIProcess/API/C/WKPage.cpp
+++ b/WebKit2/UIProcess/API/C/WKPage.cpp
@@ -152,15 +152,21 @@ void WKPageTerminate(WKPageRef pageRef)
     toImpl(pageRef)->terminateProcess();
 }
 
-WKDataRef WKPageCopySessionState(WKPageRef pageRef)
+WKStringRef WKPageGetSessionHistoryURLValueType()
 {
-    RefPtr<WebData> state = toImpl(pageRef)->sessionState();
+    static WebString* sessionHistoryURLValueType = WebString::create("SessionHistoryURL").releaseRef();
+    return toAPI(sessionHistoryURLValueType);
+}
+
+WKDataRef WKPageCopySessionState(WKPageRef pageRef, void *context, WKPageSessionStateFilterCallback filter)
+{
+    RefPtr<WebData> state = toImpl(pageRef)->sessionStateData(filter, context);
     return toAPI(state.release().releaseRef());
 }
 
 void WKPageRestoreFromSessionState(WKPageRef pageRef, WKDataRef sessionStateData)
 {
-    toImpl(pageRef)->restoreFromSessionState(toImpl(sessionStateData));
+    toImpl(pageRef)->restoreFromSessionStateData(toImpl(sessionStateData));
 }
 
 double WKPageGetTextZoomFactor(WKPageRef pageRef)
diff --git a/WebKit2/UIProcess/API/C/WKPage.h b/WebKit2/UIProcess/API/C/WKPage.h
index c0f0cc2..22cb807 100644
--- a/WebKit2/UIProcess/API/C/WKPage.h
+++ b/WebKit2/UIProcess/API/C/WKPage.h
@@ -205,7 +205,10 @@ WK_EXPORT void WKPageSetCustomUserAgent(WKPageRef page, WKStringRef userAgent);
 
 WK_EXPORT void WKPageTerminate(WKPageRef page);
 
-WK_EXPORT WKDataRef WKPageCopySessionState(WKPageRef page);
+WK_EXPORT WKStringRef WKPageGetSessionHistoryURLValueType(void);
+
+typedef bool (*WKPageSessionStateFilterCallback)(WKPageRef page, WKStringRef valueType, WKTypeRef value, void* context);
+WK_EXPORT WKDataRef WKPageCopySessionState(WKPageRef page, void *context, WKPageSessionStateFilterCallback urlAllowedCallback);
 WK_EXPORT void WKPageRestoreFromSessionState(WKPageRef page, WKDataRef sessionStateData);
 
 WK_EXPORT double WKPageGetTextZoomFactor(WKPageRef page);
diff --git a/WebKit2/UIProcess/WebBackForwardList.h b/WebKit2/UIProcess/WebBackForwardList.h
index 5459acf..8504418 100644
--- a/WebKit2/UIProcess/WebBackForwardList.h
+++ b/WebKit2/UIProcess/WebBackForwardList.h
@@ -29,14 +29,13 @@
 #include "APIObject.h"
 #include "ImmutableArray.h"
 #include "WebBackForwardListItem.h"
+#include "WebPageProxy.h"
 #include <wtf/PassRefPtr.h>
 #include <wtf/RefPtr.h>
 #include <wtf/Vector.h>
 
 namespace WebKit {
 
-class WebPageProxy;
-
 typedef Vector<RefPtr<WebBackForwardListItem> > BackForwardListItemVector;
 
 /*
@@ -72,6 +71,11 @@ public:
     PassRefPtr<ImmutableArray> backListAsImmutableArrayWithLimit(unsigned limit);
     PassRefPtr<ImmutableArray> forwardListAsImmutableArrayWithLimit(unsigned limit);
 
+#if PLATFORM(CF)
+    CFDictionaryRef createCFDictionaryRepresentation(WebPageProxy::WebPageProxySessionStateFilterCallback, void* context) const;
+    bool restoreFromCFDictionaryRepresentation(CFDictionaryRef);
+#endif
+
 private:
     WebBackForwardList(WebPageProxy*);
 
@@ -83,6 +87,14 @@ private:
     unsigned m_capacity;
     bool m_closed;
     bool m_enabled;
+    
+// FIXME - <rdar://problem/8261624> and https://bugs.webkit.org/show_bug.cgi?id=47355 - 
+// When we have a solution for restoring the full back/forward list 
+// then causing a load of the current item, we will no longer need this.
+public:
+    const WTF::String& restoredCurrentURL() const { return m_restoredCurrentURL; }
+private:
+    WTF::String m_restoredCurrentURL;
 };
 
 } // namespace WebKit
diff --git a/WebKit2/UIProcess/WebPageProxy.cpp b/WebKit2/UIProcess/WebPageProxy.cpp
index 2a14fc1..f5e2fa9 100644
--- a/WebKit2/UIProcess/WebPageProxy.cpp
+++ b/WebKit2/UIProcess/WebPageProxy.cpp
@@ -450,16 +450,18 @@ void WebPageProxy::terminateProcess()
     process()->terminate();
 }
 
-PassRefPtr<WebData> WebPageProxy::sessionState() const
+#if !PLATFORM(CF)
+PassRefPtr<WebData> WebPageProxy::sessionStateData(WebPageProxySessionStateFilterCallback, void* context) const
 {
     // FIXME: Return session state data for saving Page state.
     return 0;
 }
 
-void WebPageProxy::restoreFromSessionState(WebData*)
+void WebPageProxy::restoreFromSessionStateData(WebData*)
 {
     // FIXME: Restore the Page from the passed in session state data.
 }
+#endif
 
 void WebPageProxy::setTextZoomFactor(double zoomFactor)
 {
diff --git a/WebKit2/UIProcess/WebPageProxy.h b/WebKit2/UIProcess/WebPageProxy.h
index 3c7627b..ab548df 100644
--- a/WebKit2/UIProcess/WebPageProxy.h
+++ b/WebKit2/UIProcess/WebPageProxy.h
@@ -164,9 +164,10 @@ public:
     void setCustomUserAgent(const String&);
 
     void terminateProcess();
-    
-    PassRefPtr<WebData> sessionState() const;
-    void restoreFromSessionState(WebData*);
+
+    typedef bool (*WebPageProxySessionStateFilterCallback)(WKPageRef, WKStringRef type, WKTypeRef object, void*);
+    PassRefPtr<WebData> sessionStateData(WebPageProxySessionStateFilterCallback, void* context) const;
+    void restoreFromSessionStateData(WebData*);
 
     double textZoomFactor() const { return m_textZoomFactor; }
     void setTextZoomFactor(double);
diff --git a/WebKit2/UIProcess/cf/WebBackForwardListCF.cpp b/WebKit2/UIProcess/cf/WebBackForwardListCF.cpp
new file mode 100644
index 0000000..6ee4091
--- /dev/null
+++ b/WebKit2/UIProcess/cf/WebBackForwardListCF.cpp
@@ -0,0 +1,118 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "WebBackForwardList.h"
+#include "Logging.h"
+
+using namespace WebCore;
+
+namespace WebKit {
+
+DEFINE_STATIC_GETTER(CFStringRef, SessionHistoryCurrentIndexKey, CFSTR("SessionHistoryCurrentIndex"));
+DEFINE_STATIC_GETTER(CFStringRef, SessionHistoryEntriesKey, CFSTR("SessionHistoryEntries"));
+DEFINE_STATIC_GETTER(CFStringRef, SessionHistoryEntryTitleKey, CFSTR("SessionHistoryEntryTitle"));
+DEFINE_STATIC_GETTER(CFStringRef, SessionHistoryEntryURLKey, CFSTR("SessionHistoryEntryURL"));
+
+CFDictionaryRef WebBackForwardList::createCFDictionaryRepresentation(WebPageProxy::WebPageProxySessionStateFilterCallback filter, void* context) const
+{
+    RetainPtr<CFNumberRef> currentIndex(AdoptCF, CFNumberCreate(0, kCFNumberIntType, &m_current));    
+    RetainPtr<CFMutableArrayRef> entries(AdoptCF, CFArrayCreateMutable(0, m_entries.size(), &kCFTypeArrayCallBacks));
+    
+    const void* keys[2] = { SessionHistoryCurrentIndexKey(), SessionHistoryEntriesKey() };
+    const void* values[2] = { currentIndex.get(), entries.get() };
+
+    RetainPtr<CFDictionaryRef> dictionary(AdoptCF, CFDictionaryCreate(0, keys, values, 2, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
+
+    for (size_t i = 0; i < m_entries.size(); ++i) {
+        RefPtr<WebURL> webURL = WebURL::create(m_entries[i]->url());
+        if (!filter(toAPI(m_page), WKPageGetSessionHistoryURLValueType(), toURLRef(m_entries[i]->originalURL().impl()), context))
+            continue;
+        
+        RetainPtr<CFStringRef> url(AdoptCF, m_entries[i]->url().createCFString());
+        RetainPtr<CFStringRef> title(AdoptCF, m_entries[i]->title().createCFString());
+        
+        const void* keys[2] = { SessionHistoryEntryURLKey(), SessionHistoryEntryTitleKey() };
+        const void* values[2] = { url.get(), title.get() };
+
+        RetainPtr<CFDictionaryRef> entryDictionary(AdoptCF, CFDictionaryCreate(0, keys, values, 2, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
+        CFArrayAppendValue(entries.get(), entryDictionary.get());
+    }
+    
+    return dictionary.leakRef();
+}
+
+bool WebBackForwardList::restoreFromCFDictionaryRepresentation(CFDictionaryRef dictionary)
+{
+    CFNumberRef cfIndex = (CFNumberRef)CFDictionaryGetValue(dictionary, SessionHistoryCurrentIndexKey());
+    if (!cfIndex || CFGetTypeID(cfIndex) != CFNumberGetTypeID()) {
+        LOG(SessionState, "WebBackForwardList dictionary representation does not have a valid current index");
+        return false;
+    }
+    
+    unsigned currentIndex;
+    if (!CFNumberGetValue(cfIndex, kCFNumberIntType, &currentIndex)) {
+        LOG(SessionState, "WebBackForwardList dictionary representation does not have a valid integer current index");
+        return false;
+    }
+    
+    CFArrayRef cfEntries = (CFArrayRef)CFDictionaryGetValue(dictionary, SessionHistoryEntriesKey());
+    if (!cfEntries || CFGetTypeID(cfEntries) != CFArrayGetTypeID()) {
+        LOG(SessionState, "WebBackForwardList dictionary representation does not have a valid list of entries");
+        return false;
+    }
+    
+    CFIndex size = CFArrayGetCount(cfEntries);
+    for (CFIndex i = 0; i < size; ++i) {
+        CFDictionaryRef entryDictionary = (CFDictionaryRef)CFArrayGetValueAtIndex(cfEntries, i);
+        if (!entryDictionary || CFGetTypeID(entryDictionary) != CFDictionaryGetTypeID()) {
+            LOG(SessionState, "WebBackForwardList entry array does not have a valid entry at index %i", (int)i);
+            return false;
+        }
+        
+        CFStringRef entryURL = (CFStringRef)CFDictionaryGetValue(entryDictionary, SessionHistoryEntryURLKey());
+        if (!entryURL || CFGetTypeID(entryURL) != CFStringGetTypeID()) {
+            LOG(SessionState, "WebBackForwardList entry at index %i does not have a valid URL", (int)i);
+            return false;
+        }
+
+        CFStringRef entryTitle = (CFStringRef)CFDictionaryGetValue(entryDictionary, SessionHistoryEntryTitleKey());
+        if (!entryTitle || CFGetTypeID(entryTitle) != CFStringGetTypeID()) {
+            LOG(SessionState, "WebBackForwardList entry at index %i does not have a valid title", (int)i);
+            return false;
+        }
+        
+        // FIXME <rdar://problem/8261624> and https://bugs.webkit.org/show_bug.cgi?id=47355 - 
+        // The data for the above entry needs to be added to the full back/forward list.
+        // When we have a solution that restores the full back/forwardlist then causes a load of the current item,
+        // we will no longer need this.
+        if (i == currentIndex) {
+            m_restoredCurrentURL = entryURL;
+            break;
+        }
+    }
+    return true;
+}
+
+} // namespace WebKit
diff --git a/WebKit2/UIProcess/cf/WebPageProxyCF.cpp b/WebKit2/UIProcess/cf/WebPageProxyCF.cpp
new file mode 100644
index 0000000..c399a16
--- /dev/null
+++ b/WebKit2/UIProcess/cf/WebPageProxyCF.cpp
@@ -0,0 +1,117 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "WebPageProxy.h"
+
+#include "Logging.h"
+#include "WebBackForwardList.h"
+#include "WebData.h"
+
+using namespace WebCore;
+
+namespace WebKit {
+
+DEFINE_STATIC_GETTER(CFStringRef, SessionHistoryKey, CFSTR("SessionHistory"));
+
+static const UInt32 CurrentSessionStateDataVersion = 1;
+
+PassRefPtr<WebData> WebPageProxy::sessionStateData(WebPageProxySessionStateFilterCallback filter, void* context) const
+{
+    RetainPtr<CFDictionaryRef> sessionHistoryDictionary(AdoptCF, m_backForwardList->createCFDictionaryRepresentation(filter, context));
+    
+    // For now we're only serializing the back/forward list.  If that object is null, then the entire sessionState can be null.
+    if (!sessionHistoryDictionary)
+        return 0;
+    
+    const void* keys[1] = { SessionHistoryKey() };
+    const void* values[1] = { sessionHistoryDictionary.get() };
+    
+    RetainPtr<CFDictionaryRef> stateDictionary(AdoptCF, CFDictionaryCreate(0, keys, values, 1, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
+
+    RetainPtr<CFDataRef> stateCFData(AdoptCF, CFPropertyListCreateData(0, stateDictionary.get(), kCFPropertyListBinaryFormat_v1_0, 0, 0));
+
+    CFIndex length = CFDataGetLength(stateCFData.get());
+    Vector<unsigned char> stateVector(length + 4);
+    
+    // Put the session state version number at the start of the buffer
+    stateVector.data()[0] = (CurrentSessionStateDataVersion & 0xFF000000) >> 24;
+    stateVector.data()[1] = (CurrentSessionStateDataVersion & 0x00FF0000) >> 16;
+    stateVector.data()[2] = (CurrentSessionStateDataVersion & 0x0000FF00) >> 8;
+    stateVector.data()[3] = (CurrentSessionStateDataVersion & 0x000000FF);
+    
+    // Copy in the actual session state data
+    CFDataGetBytes(stateCFData.get(), CFRangeMake(0, length), stateVector.data() + 4);
+    
+    return WebData::create(stateVector);
+}
+
+void WebPageProxy::restoreFromSessionStateData(WebData* webData)
+{
+    if (!webData || webData->size() < 4)
+        return;
+
+    const unsigned char* buffer = webData->bytes();
+    UInt32 versionHeader = (buffer[0] << 24) + (buffer[1] << 16) + (buffer[2] << 8) + buffer[3];
+    
+    if (versionHeader != CurrentSessionStateDataVersion) {
+        LOG(SessionState, "Unrecognized version header for session state data - cannot restore");
+        return;
+    }
+    
+    RetainPtr<CFDataRef> data(AdoptCF, CFDataCreate(0, webData->bytes() + 4, webData->size() - 4));
+
+    CFErrorRef propertyListError = 0;
+    RetainPtr<CFPropertyListRef> propertyList(AdoptCF, CFPropertyListCreateWithData(0, data.get(), kCFPropertyListImmutable, 0, &propertyListError));
+    if (propertyListError) {
+        LOG(SessionState, "Could not read session state property list");
+        return;
+    }
+
+    if (!propertyList)
+        return;
+        
+    if (CFGetTypeID(propertyList.get()) != CFDictionaryGetTypeID()) {
+        LOG(SessionState, "SessionState property list is not a CFDictionaryRef (%i) - its CFTypeID is %i", (int)CFDictionaryGetTypeID(), (int)CFGetTypeID(propertyList.get()));
+        return;
+    }
+    
+    CFTypeRef sessionHistoryRef = CFDictionaryGetValue(static_cast<CFDictionaryRef>(propertyList.get()), SessionHistoryKey());
+    if (!sessionHistoryRef || CFGetTypeID(sessionHistoryRef) != CFDictionaryGetTypeID()) {
+        LOG(SessionState, "SessionState dictionary does not contain a SessionHistoryDictionary key, it is of the wrong type");
+        return;
+    }
+    
+    CFDictionaryRef sessionHistoryDictionary = static_cast<CFDictionaryRef>(sessionHistoryRef);
+    if (!m_backForwardList->restoreFromCFDictionaryRepresentation(sessionHistoryDictionary)) {
+        LOG(SessionState, "Failed to restore back/forward list from SessionHistoryDictionary");
+        return;
+    }
+
+    // FIXME: When we have a solution for restoring the full back/forward list then causing a load of the current item,
+    // we will trigger that load here.  Until then, we use the "restored current URL" which can later be removed.
+    loadURL(m_backForwardList->restoredCurrentURL());
+}
+
+} // namespace WebKit
diff --git a/WebKit2/WebKit2.xcodeproj/project.pbxproj b/WebKit2/WebKit2.xcodeproj/project.pbxproj
index a666620..b3b3380 100644
--- a/WebKit2/WebKit2.xcodeproj/project.pbxproj
+++ b/WebKit2/WebKit2.xcodeproj/project.pbxproj
@@ -143,6 +143,8 @@
 		516A4A5D120A2CCD00C05B7F /* WebError.h in Headers */ = {isa = PBXBuildFile; fileRef = 516A4A5B120A2CCD00C05B7F /* WebError.h */; };
 		51A7F2F3125BF820008AEB1D /* Logging.h in Headers */ = {isa = PBXBuildFile; fileRef = 51A7F2F2125BF820008AEB1D /* Logging.h */; };
 		51A7F2F5125BF8D4008AEB1D /* Logging.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51A7F2F4125BF8D4008AEB1D /* Logging.cpp */; };
+		51B3005012529D0E000B5CA0 /* WebBackForwardListCF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51B3004E12529D0E000B5CA0 /* WebBackForwardListCF.cpp */; };
+		51B3005112529D0E000B5CA0 /* WebPageProxyCF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51B3004F12529D0E000B5CA0 /* WebPageProxyCF.cpp */; };
 		6D8A91A611F0EFD100DD01FE /* com.apple.WebProcess.sb in Resources */ = {isa = PBXBuildFile; fileRef = 6D8A91A511F0EFD100DD01FE /* com.apple.WebProcess.sb */; };
 		762B748D120BC75C00819339 /* WKPreferencesPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 762B7484120BBA2D00819339 /* WKPreferencesPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		762B74AF120BC94F00819339 /* WKPreferencesPrivate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 762B749D120BC8EA00819339 /* WKPreferencesPrivate.cpp */; };
@@ -599,6 +601,8 @@
 		516A4A5B120A2CCD00C05B7F /* WebError.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebError.h; sourceTree = "<group>"; };
 		51A7F2F2125BF820008AEB1D /* Logging.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Logging.h; sourceTree = "<group>"; };
 		51A7F2F4125BF8D4008AEB1D /* Logging.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Logging.cpp; sourceTree = "<group>"; };
+		51B3004E12529D0E000B5CA0 /* WebBackForwardListCF.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WebBackForwardListCF.cpp; path = cf/WebBackForwardListCF.cpp; sourceTree = "<group>"; };
+		51B3004F12529D0E000B5CA0 /* WebPageProxyCF.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WebPageProxyCF.cpp; path = cf/WebPageProxyCF.cpp; sourceTree = "<group>"; };
 		5DAD7294116FF70B00EE5396 /* WebProcess.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = WebProcess.xcconfig; sourceTree = "<group>"; };
 		5DAD73F1116FF90C00EE5396 /* BaseTarget.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = BaseTarget.xcconfig; sourceTree = "<group>"; };
 		6D8A91A511F0EFD100DD01FE /* com.apple.WebProcess.sb */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = com.apple.WebProcess.sb; path = WebProcess/com.apple.WebProcess.sb; sourceTree = "<group>"; };
@@ -646,7 +650,7 @@
 		BC111AE3112F5C2600337BAB /* WebProcess.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebProcess.cpp; sourceTree = "<group>"; };
 		BC111B08112F5E3C00337BAB /* ResponsivenessTimer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ResponsivenessTimer.cpp; sourceTree = "<group>"; };
 		BC111B0A112F5E4F00337BAB /* WebFrameProxy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebFrameProxy.cpp; sourceTree = "<group>"; };
-		BC111B0B112F5E4F00337BAB /* WebPageProxy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebPageProxy.cpp; sourceTree = "<group>"; };
+		BC111B0B112F5E4F00337BAB /* WebPageProxy.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.cpp; fileEncoding = 4; path = WebPageProxy.cpp; sourceTree = "<group>"; };
 		BC111B0C112F5E4F00337BAB /* WebProcessManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebProcessManager.cpp; sourceTree = "<group>"; };
 		BC111B0D112F5E4F00337BAB /* WebProcessProxy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebProcessProxy.cpp; sourceTree = "<group>"; };
 		BC111B1B112F5FE600337BAB /* ProcessLauncherMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ProcessLauncherMac.mm; sourceTree = "<group>"; };
@@ -1229,6 +1233,15 @@
 			name = "Other Sources";
 			sourceTree = "<group>";
 		};
+		51B3004D12529CF5000B5CA0 /* cf */ = {
+			isa = PBXGroup;
+			children = (
+				51B3004E12529D0E000B5CA0 /* WebBackForwardListCF.cpp */,
+				51B3004F12529D0E000B5CA0 /* WebPageProxyCF.cpp */,
+			);
+			name = cf;
+			sourceTree = "<group>";
+		};
 		BC032D5C10F436D50058C15A /* WebProcess */ = {
 			isa = PBXGroup;
 			children = (
@@ -1302,6 +1315,7 @@
 			isa = PBXGroup;
 			children = (
 				BC032DC410F4387C0058C15A /* API */,
+				51B3004D12529CF5000B5CA0 /* cf */,
 				BC111B18112F5FB400337BAB /* Launcher */,
 				BCCF085C113F3B7500C650C5 /* mac */,
 				1AEFCC0511D01F34008219D3 /* Plugins */,
@@ -2260,6 +2274,8 @@
 				1A043F6912514D8B00FFBFB5 /* WebProcessConnectionMessageReceiver.cpp in Sources */,
 				1A8EF4CC1252403700F7067F /* PluginControllerProxy.cpp in Sources */,
 				C02BFF1E1251502E009CCBEA /* NativeWebKeyboardEventMac.mm in Sources */,
+				51B3005012529D0E000B5CA0 /* WebBackForwardListCF.cpp in Sources */,
+				51B3005112529D0E000B5CA0 /* WebPageProxyCF.cpp in Sources */,
 				1A8EF96E1252AF6B00F7067F /* PluginControllerProxyMessageReceiver.cpp in Sources */,
 				1A8EFA701252B84100F7067F /* PluginProxyMessageReceiver.cpp in Sources */,
 				1A8EFDFE1253CB6E00F7067F /* DataReference.cpp in Sources */,
diff --git a/WebKit2/WebKit2Prefix.h b/WebKit2/WebKit2Prefix.h
index 0132c50..ef91570 100644
--- a/WebKit2/WebKit2Prefix.h
+++ b/WebKit2/WebKit2Prefix.h
@@ -37,6 +37,14 @@
 #define EXTERN_C_END
 #endif
 
+// For defining getters to a static value, where the getters have internal linkage
+#define DEFINE_STATIC_GETTER(type, name, arguments) \
+static const type& name() \
+{ \
+    DEFINE_STATIC_LOCAL(type, name##Value, arguments); \
+    return name##Value; \
+}
+
 #if defined(BUILDING_QT__)
 
 #define WTF_USE_JSC 1
diff --git a/WebKit2/win/WebKit2.vcproj b/WebKit2/win/WebKit2.vcproj
index 6152539..28685b1 100755
--- a/WebKit2/win/WebKit2.vcproj
+++ b/WebKit2/win/WebKit2.vcproj
@@ -1729,6 +1729,18 @@
 				</Filter>
 			</Filter>
 			<Filter
+				Name="cf"
+				>
+				<File
+					RelativePath="..\UIProcess\cf\WebBackForwardListCF.cpp"
+					>
+				</File>
+				<File
+					RelativePath="..\UIProcess\cf\WebPageProxyCF.cpp"
+					>
+				</File>
+			</Filter>
+			<Filter
 				Name="Launcher"
 				>
 				<File

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list