Bug 168147

Summary: Add new WKWebKit Cocoa API for getContentsAsString
Product: WebKit Reporter: Jason Rinn <jrinn>
Component: WebKit APIAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: andersca, bdakin, commit-queue, ggaren, mitz, thorton, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch none

Jason Rinn
Reported 2017-02-10 14:45:27 PST
Add new WKWebKit Cocoa API for getContentsAsString
Attachments
Patch (10.08 KB, patch)
2017-02-13 16:05 PST, Jason Rinn
no flags
Patch (9.83 KB, patch)
2017-02-13 18:39 PST, Jason Rinn
no flags
Jason Rinn
Comment 1 2017-02-13 16:05:10 PST
Tim Horton
Comment 2 2017-02-13 16:14:02 PST
Comment on attachment 301407 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=301407&action=review > Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm:3807 > + auto handler = adoptNS([completionHandler copy]); This should probably use BlockPtr these days. > Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm:3813 > + RetainPtr<NSError> error = adoptNS([[NSError alloc] init]); This actually logs an error, and the other uses (of [[NSError alloc] init]) are wrong. Should we fix it? Or just propagate the wrongness. > Tools/TestWebKitAPI/Tests/WebKit2Cocoa/WKWebViewGetContents.mm:42 > + NSURLRequest *request = [NSURLRequest requestWithURL:[[NSBundle mainBundle] URLForResource:@"simple" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"]]; > + [webView loadRequest:request]; > + [webView _test_waitForDidFinishNavigation]; If you want, if you use the TestWKWebView subclass instead of WKWebView directly, it has synchronouslyLoadTestPageNamed, which will replace all of these lines.
Radar WebKit Bug Importer
Comment 3 2017-02-13 16:41:16 PST
Tim Horton
Comment 4 2017-02-13 17:15:00 PST
Comment on attachment 301407 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=301407&action=review > Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h:229 > +- (void)_getContentsAsStringWithCompletionHandler:(void (^)(NSString *, NSError *))completionHandler; Also, Dan points out that you've forgotten your API availability macros.
Tim Horton
Comment 5 2017-02-13 17:26:23 PST
(In reply to comment #4) > Comment on attachment 301407 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=301407&action=review > > > Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h:229 > > +- (void)_getContentsAsStringWithCompletionHandler:(void (^)(NSString *, NSError *))completionHandler; > > Also, Dan points out that you've forgotten your API availability macros. Like this: WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA))
Jason Rinn
Comment 6 2017-02-13 18:39:07 PST
WebKit Commit Bot
Comment 7 2017-02-14 16:13:15 PST
Comment on attachment 301434 [details] Patch Clearing flags on attachment: 301434 Committed r212334: <http://trac.webkit.org/changeset/212334>
WebKit Commit Bot
Comment 8 2017-02-14 16:13:20 PST
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.