Title: [203014] trunk/Source/WebKit2
Revision
203014
Author
[email protected]
Date
2016-07-08 17:43:16 -0700 (Fri, 08 Jul 2016)

Log Message

When WKWebView prepares the session state blob, we should be able to filter it.
https://bugs.webkit.org/show_bug.cgi?id=159410

Add a SPI to WKWebView so that a client can decide how to filter backforward items
when WKWebView perparing session state.

Patch by Yongjun Zhang <[email protected]> on 2016-07-08
Reviewed by Brady Eidson.

* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _sessionStateWithFilter:]): When preparing session state, check each
backforward item against the filter block.
* UIProcess/API/Cocoa/WKWebViewPrivate.h: Add the SPI _sessionStateWithFilter:

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (203013 => 203014)


--- trunk/Source/WebKit2/ChangeLog	2016-07-09 00:28:23 UTC (rev 203013)
+++ trunk/Source/WebKit2/ChangeLog	2016-07-09 00:43:16 UTC (rev 203014)
@@ -1,3 +1,19 @@
+2016-07-08  Yongjun Zhang  <[email protected]>
+
+        When WKWebView prepares the session state blob, we should be able to filter it.
+        https://bugs.webkit.org/show_bug.cgi?id=159410
+
+        Add a SPI to WKWebView so that a client can decide how to filter backforward items
+        when WKWebView perparing session state.
+
+        Reviewed by Brady Eidson.
+
+        * UIProcess/API/Cocoa/WKWebView.mm:
+        (-[WKWebView _sessionStateWithFilter:]): When preparing session state, check each
+        backforward item against the filter block.
+        * UIProcess/API/Cocoa/WKWebViewPrivate.h: Add the SPI _sessionStateWithFilter:
+
+
 2016-07-08  Tim Horton  <[email protected]>
 
         Mail messages don't start loading until scrolling completes

Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm (203013 => 203014)


--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm	2016-07-09 00:28:23 UTC (rev 203013)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm	2016-07-09 00:43:16 UTC (rev 203014)
@@ -3373,6 +3373,18 @@
     return adoptNS([[_WKSessionState alloc] _initWithSessionState:_page->sessionState()]).autorelease();
 }
 
+- (_WKSessionState *)_sessionStateWithFilter:(BOOL (^)(WKBackForwardListItem *item))filter
+{
+    WebKit::SessionState sessionState = _page->sessionState([filter](WebKit::WebBackForwardListItem& item) {
+        if (!filter)
+            return true;
+
+        return (bool)filter(wrapper(item));
+    });
+
+    return adoptNS([[_WKSessionState alloc] _initWithSessionState:sessionState]).autorelease();
+}
+
 - (void)_restoreFromSessionStateData:(NSData *)sessionStateData
 {
     // FIXME: This should not use the legacy session state decoder.

Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h (203013 => 203014)


--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h	2016-07-09 00:28:23 UTC (rev 203013)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h	2016-07-09 00:43:16 UTC (rev 203014)
@@ -100,6 +100,7 @@
 
 @property (nonatomic, readonly) _WKSessionState *_sessionState;
 - (WKNavigation *)_restoreSessionState:(_WKSessionState *)sessionState andNavigate:(BOOL)navigate;
+- (_WKSessionState *)_sessionStateWithFilter:(BOOL (^)(WKBackForwardListItem *item))filter;
 
 @property (nonatomic, setter=_setAllowsRemoteInspection:) BOOL _allowsRemoteInspection;
 @property (nonatomic, copy, setter=_setRemoteInspectionNameOverride:) NSString *_remoteInspectionNameOverride WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to