<html>
<head>
<base href="https://bugs.webkit.org/" />
</head>
<body>
<p>
<div>
<b><a class="bz_bug_link
bz_status_NEW "
title="NEW - When WKWebView prepares the session state blob, we should be able to filter it."
href="https://bugs.webkit.org/show_bug.cgi?id=159410#c10">Comment # 10</a>
on <a class="bz_bug_link
bz_status_NEW "
title="NEW - When WKWebView prepares the session state blob, we should be able to filter it."
href="https://bugs.webkit.org/show_bug.cgi?id=159410">bug 159410</a>
from <span class="vcard"><a class="email" href="mailto:beidson@apple.com" title="Brady Eidson <beidson@apple.com>"> <span class="fn">Brady Eidson</span></a>
</span></b>
<pre>Comment on <span class=""><a href="attachment.cgi?id=282914&action=diff" name="attach_282914" title="Add a SPI to WKWebView so that we can filter the session state.">attachment 282914</a> <a href="attachment.cgi?id=282914&action=edit" title="Add a SPI to WKWebView so that we can filter the session state.">[details]</a></span>
Add a SPI to WKWebView so that we can filter the session state.
View in context: <a href="https://bugs.webkit.org/attachment.cgi?id=282914&action=review">https://bugs.webkit.org/attachment.cgi?id=282914&action=review</a>
<span class="quote">> Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm:3378
> + auto handler = adoptNS([filter copy]);
> + WebKit::SessionState sessionState = _page->sessionState([handler](WebKit::WebBackForwardListItem& item) {</span >
Can put the filter copy inside the lambda:
[handler = adoptNS([filter copy])]
<span class="quote">> Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm:3384
> + BOOL (^filterBlock)(WKBackForwardListItem *item) = (BOOL (^)(WKBackForwardListItem *item))handler.get();
> + if (filterBlock) {
> + if (!filterBlock(wrapper(item)))
> + return false;
> + }
> + return true;</span >
This should be able to be simpler:
if (!handler)
return true;
BOOL (^filterBlock)(WKBackForwardListItem *item) = (BOOL (^)(WKBackForwardListItem *item))handler.get();
return filterBlock(wrapper(item));</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>