Bug 128930 - Add history delegate to WKWebView
Summary: Add history delegate to WKWebView
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Anders Carlsson
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-02-17 13:20 PST by Anders Carlsson
Modified: 2014-02-17 16:39 PST (History)
1 user (show)

See Also:


Attachments
Patch (26.96 KB, patch)
2014-02-17 13:21 PST, Anders Carlsson
mitz: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Anders Carlsson 2014-02-17 13:20:45 PST
Add history delegate to WKWebView
Comment 1 Anders Carlsson 2014-02-17 13:21:03 PST
Created attachment 224416 [details]
Patch
Comment 2 WebKit Commit Bot 2014-02-17 13:21:46 PST
Attachment 224416 [details] did not pass style-queue:


ERROR: Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h:46:  Missing spaces around =  [whitespace/operators] [4]
Total errors found: 1 in 10 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 mitz 2014-02-17 15:50:44 PST
Comment on attachment 224416 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=224416&action=review

r=me but there is a critical typo

> Source/WebKit2/UIProcess/API/Cocoa/WKHistoryDelegatePrivate.h:40
> +- (void)webView:(WKWebView *)webView didNavigateWithNavigationData:(WKNavigationData *)navigationData;
> +- (void)webView:(WKWebView *)webView didPerformClientRedirectFromURL:(NSURL *)sourceURL toURL:(NSURL *)destinationURL;
> +- (void)webView:(WKWebView *)webView didPerformServerRedirectFromURL:(NSURL *)sourceURL toURL:(NSURL *)destinationURL;
> +- (void)webView:(WKWebView *)webView didUpdateHistoryTitle:(NSString *)title forURL:(NSURL *)URL;

Let’s prefix all methods in private delegates with _.

> Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm:465
> +- (id<WKHistoryDelegatePrivate>)_historyDelegate

Missing space after id

> Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm:470
> +- (void)_setHistoryDelegate:(id<WKHistoryDelegatePrivate>)historyDelegate

Ditto

> Source/WebKit2/UIProcess/Cocoa/NavigationState.mm:174
> +    [historyDelegate webView:m_webView didPerformClientRedirectFromURL:wrapper(*API::URL::create(sourceURL)) toURL:wrapper(*API::URL::create(destinationURL))];

Let’s avoid wrappers here and use +[NSURL _web_URLWithWTFString:].

> Source/WebKit2/UIProcess/Cocoa/NavigationState.mm:186
> +    [historyDelegate webView:m_webView didPerformClientRedirectFromURL:wrapper(*API::URL::create(sourceURL)) toURL:wrapper(*API::URL::create(destinationURL))];

Typo: s/Client/Server/!
Let’s avoid wrappers here and use +[NSURL _web_URLWithWTFString:].

> Source/WebKit2/UIProcess/Cocoa/NavigationState.mm:198
> +    [historyDelegate.get() webView:m_webView didUpdateHistoryTitle:wrapper(*API::String::create(title)) forURL:wrapper(*API::URL::create(url))];

Let’s avoid wrappers here and use the ability of WTF::String to turn into an NSString (and _web_URLWithWTFString:).
Comment 4 Anders Carlsson 2014-02-17 16:39:15 PST
Committed r164258: <http://trac.webkit.org/changeset/164258>