Title: [148112] trunk/Source/WebKit2
Revision
148112
Author
[email protected]
Date
2013-04-10 11:14:33 -0700 (Wed, 10 Apr 2013)

Log Message

<rdar://problem/13617104> WKPageCopySessionState needs to provide more context to the filter callback

Introduce a new value type for WKPageSessionStateFilterCallback that represents the passing
of whole WKBackForwardListItemRefs to the filter callback. This allows clients to consider
more than the original URL of the item when filtering entries from the session state.

Reviewed by Darin Adler.

* UIProcess/API/C/WKPage.cpp:
(WKPageGetSessionBackForwardListItemValueType): Return a static string representing our new value type.
* UIProcess/API/C/WKPage.h:
* UIProcess/cf/WebBackForwardListCF.cpp:
(WebKit::WebBackForwardList::createCFDictionaryRepresentation): Call the filter function with each of the
possible value types in turn, respecting the first false value, if any, that is returned.

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (148111 => 148112)


--- trunk/Source/WebKit2/ChangeLog	2013-04-10 18:07:41 UTC (rev 148111)
+++ trunk/Source/WebKit2/ChangeLog	2013-04-10 18:14:33 UTC (rev 148112)
@@ -1,3 +1,20 @@
+2013-04-09  Mark Rowe  <[email protected]>
+
+        <rdar://problem/13617104> WKPageCopySessionState needs to provide more context to the filter callback
+
+        Introduce a new value type for WKPageSessionStateFilterCallback that represents the passing
+        of whole WKBackForwardListItemRefs to the filter callback. This allows clients to consider
+        more than the original URL of the item when filtering entries from the session state.
+
+        Reviewed by Darin Adler.
+
+        * UIProcess/API/C/WKPage.cpp:
+        (WKPageGetSessionBackForwardListItemValueType): Return a static string representing our new value type.
+        * UIProcess/API/C/WKPage.h:
+        * UIProcess/cf/WebBackForwardListCF.cpp:
+        (WebKit::WebBackForwardList::createCFDictionaryRepresentation): Call the filter function with each of the
+        possible value types in turn, respecting the first false value, if any, that is returned.
+
 2013-04-10  Anton Obzhirov  <[email protected]>
 
         [GTK] Add support for Page Visibility

Modified: trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp (148111 => 148112)


--- trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp	2013-04-10 18:07:41 UTC (rev 148111)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp	2013-04-10 18:14:33 UTC (rev 148112)
@@ -264,6 +264,12 @@
     return toAPI(sessionHistoryURLValueType);
 }
 
+WKStringRef WKPageGetSessionBackForwardListItemValueType()
+{
+    static WebString* sessionBackForwardListValueType = WebString::create("SessionBackForwardListItem").leakRef();
+    return toAPI(sessionBackForwardListValueType);
+}
+
 WKDataRef WKPageCopySessionState(WKPageRef pageRef, void *context, WKPageSessionStateFilterCallback filter)
 {
     return toAPI(toImpl(pageRef)->sessionStateData(filter, context).leakRef());

Modified: trunk/Source/WebKit2/UIProcess/API/C/WKPage.h (148111 => 148112)


--- trunk/Source/WebKit2/UIProcess/API/C/WKPage.h	2013-04-10 18:07:41 UTC (rev 148111)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKPage.h	2013-04-10 18:14:33 UTC (rev 148112)
@@ -410,6 +410,7 @@
 WK_EXPORT void WKPageTerminate(WKPageRef page);
 
 WK_EXPORT WKStringRef WKPageGetSessionHistoryURLValueType(void);
+WK_EXPORT WKStringRef WKPageGetSessionBackForwardListItemValueType(void);
 
 typedef bool (*WKPageSessionStateFilterCallback)(WKPageRef page, WKStringRef valueType, WKTypeRef value, void* context);
 WK_EXPORT WKDataRef WKPageCopySessionState(WKPageRef page, void* context, WKPageSessionStateFilterCallback urlAllowedCallback);

Modified: trunk/Source/WebKit2/UIProcess/cf/WebBackForwardListCF.cpp (148111 => 148112)


--- trunk/Source/WebKit2/UIProcess/cf/WebBackForwardListCF.cpp	2013-04-10 18:07:41 UTC (rev 148111)
+++ trunk/Source/WebKit2/UIProcess/cf/WebBackForwardListCF.cpp	2013-04-10 18:14:33 UTC (rev 148112)
@@ -88,10 +88,13 @@
             return 0;
         }
 
-        if (filter && !filter(toAPI(m_page), WKPageGetSessionHistoryURLValueType(), toURLRef(m_entries[i]->originalURL().impl()), context)) {
-            if (i <= m_currentIndex)
-                currentIndex--;
-            continue;
+        if (filter) {
+            if (!filter(toAPI(m_page), WKPageGetSessionBackForwardListItemValueType(), toAPI(m_entries[i].get()), context)
+                || !filter(toAPI(m_page), WKPageGetSessionHistoryURLValueType(), toURLRef(m_entries[i]->originalURL().impl()), context)) {
+                if (i <= m_currentIndex)
+                    currentIndex--;
+                continue;
+            }
         }
         
         RetainPtr<CFStringRef> url = ""
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to