Bug 223657

Summary: [Cocoa] Revise loadSimulatedRequest API with final review comments
Product: WebKit Reporter: Brent Fulgham <bfulgham>
Component: WebKit Misc.Assignee: Brent Fulgham <bfulgham>
Status: RESOLVED FIXED    
Severity: Normal CC: achristensen, bfulgham, ggaren, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch none

Description Brent Fulgham 2021-03-23 14:27:49 PDT
We've received final internal review on the proposed Cocoa API for loadSimulatedRequest, which suggested two small changes. This patch exposes the final API, and marks the prior version as deprecated.

1. Revise 'with' label to just be 'response'.

- (WKNavigation *)loadSimulatedRequest:(NSURLRequest *)request withResponse:(NSURLResponse *)response responseData:(NSData *)data;

Becomes

- (WKNavigation *)loadSimulatedRequest:(NSURLRequest *)request response:(NSURLResponse *)response responseData:(NSData *)data;


2. Revise 'withResponseHTML' to 'responseHTML'

- (WKNavigation *)loadSimulatedRequest:(NSURLRequest *)request withResponseHTMLString:(NSString *)string;

Becomes

- (WKNavigation *)loadSimulatedRequest:(NSURLRequest *)request responseHTMLString:(NSString *)string;
Comment 1 Radar WebKit Bug Importer 2021-03-23 15:18:07 PDT
<rdar://problem/75757727>
Comment 2 Brent Fulgham 2021-03-23 16:16:10 PDT
Created attachment 424076 [details]
Patch
Comment 3 Alex Christensen 2021-03-23 16:55:12 PDT
Comment on attachment 424076 [details]
Patch

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

> Source/WebKit/UIProcess/API/Cocoa/WKWebView.h:492
> +- (WKNavigation *)loadSimulatedRequest:(NSURLRequest *)request response:(NSURLResponse *)response responseData:(NSData *)data WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA));

Nobody suggested responseBody instead of responseData?

> Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebViewLoadAPIs.mm:54
> +    [delegate waitForDidFinishNavigation];

This should do more than just wait until navigation finishes.  It should verify that the data did load how we think it should.
Comment 4 EWS 2021-03-24 10:03:14 PDT
Committed r274944: <https://commits.webkit.org/r274944>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 424076 [details].