Title: [274944] trunk
- Revision
- 274944
- Author
- bfulg...@apple.com
- Date
- 2021-03-24 10:03:09 -0700 (Wed, 24 Mar 2021)
Log Message
[Cocoa] Revise loadSimulatedRequest API with final review comments (223657)
https://bugs.webkit.org/show_bug.cgi?id=223657
<rdar://75757727>
Reviewed by Alex Christensen.
Source/WebKit:
Tested by TestWebKitAPI.
Update the WKWebView API to match final review comments. Deprecate the prior draft API so that we
can smoothly transition away from the original methods.
* UIProcess/API/Cocoa/WKWebView.h:
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView loadSimulatedRequest:response:responseData:]):
(-[WKWebView loadSimulatedRequest:withResponse:responseData:]):
(-[WKWebView loadSimulatedRequest:responseHTMLString:]):
(-[WKWebView loadSimulatedRequest:withResponseHTMLString:]):
Tools:
Update tests to use the final API, while still exercising the existing API.
* TestWebKitAPI/Tests/WebKitCocoa/WKWebViewLoadAPIs.mm:
(TEST):
Modified Paths
Diff
Modified: trunk/Source/WebKit/ChangeLog (274943 => 274944)
--- trunk/Source/WebKit/ChangeLog 2021-03-24 16:59:39 UTC (rev 274943)
+++ trunk/Source/WebKit/ChangeLog 2021-03-24 17:03:09 UTC (rev 274944)
@@ -1,3 +1,23 @@
+2021-03-24 Brent Fulgham <bfulg...@apple.com>
+
+ [Cocoa] Revise loadSimulatedRequest API with final review comments (223657)
+ https://bugs.webkit.org/show_bug.cgi?id=223657
+ <rdar://75757727>
+
+ Reviewed by Alex Christensen.
+
+ Tested by TestWebKitAPI.
+
+ Update the WKWebView API to match final review comments. Deprecate the prior draft API so that we
+ can smoothly transition away from the original methods.
+
+ * UIProcess/API/Cocoa/WKWebView.h:
+ * UIProcess/API/Cocoa/WKWebView.mm:
+ (-[WKWebView loadSimulatedRequest:response:responseData:]):
+ (-[WKWebView loadSimulatedRequest:withResponse:responseData:]):
+ (-[WKWebView loadSimulatedRequest:responseHTMLString:]):
+ (-[WKWebView loadSimulatedRequest:withResponseHTMLString:]):
+
2021-03-24 Sihui Liu <sihui_...@appe.com>
Ignore middle commits during animated resize
Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.h (274943 => 274944)
--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.h 2021-03-24 16:59:39 UTC (rev 274943)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.h 2021-03-24 17:03:09 UTC (rev 274944)
@@ -489,7 +489,8 @@
@param data The data to use as the contents of the webpage.
@result A new navigation.
*/
-- (WKNavigation *)loadSimulatedRequest:(NSURLRequest *)request withResponse:(NSURLResponse *)response responseData:(NSData *)data WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA));
+- (WKNavigation *)loadSimulatedRequest:(NSURLRequest *)request response:(NSURLResponse *)response responseData:(NSData *)data WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA));
+- (WKNavigation *)loadSimulatedRequest:(NSURLRequest *)request withResponse:(NSURLResponse *)response responseData:(NSData *)data WK_API_DEPRECATED_WITH_REPLACEMENT("loadSimulatedRequest:response:responseData:", macos(WK_MAC_TBA, WK_MAC_TBA), ios(WK_IOS_TBA, WK_IOS_TBA));
/*! @abstract Navigates to the requested file URL on the filesystem.
@param request The request specifying the file URL to which to navigate.
@@ -510,7 +511,8 @@
@param string The data to use as the contents of the webpage.
@result A new navigation.
*/
-- (WKNavigation *)loadSimulatedRequest:(NSURLRequest *)request withResponseHTMLString:(NSString *)string NS_SWIFT_NAME(loadSimulatedRequest(_:withResponseHTML:)) WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA));
+- (WKNavigation *)loadSimulatedRequest:(NSURLRequest *)request responseHTMLString:(NSString *)string NS_SWIFT_NAME(loadSimulatedRequest(_:responseHTML:)) WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA));
+- (WKNavigation *)loadSimulatedRequest:(NSURLRequest *)request withResponseHTMLString:(NSString *)string NS_SWIFT_NAME(loadSimulatedRequest(_:withResponseHTML:)) WK_API_DEPRECATED_WITH_REPLACEMENT("loadSimulatedRequest:responseHTMLString:", macos(WK_MAC_TBA, WK_MAC_TBA), ios(WK_IOS_TBA, WK_IOS_TBA));
#if !TARGET_OS_IPHONE
/* @abstract Returns an NSPrintOperation object configured to print the contents of this WKWebView
Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm (274943 => 274944)
--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm 2021-03-24 16:59:39 UTC (rev 274943)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm 2021-03-24 17:03:09 UTC (rev 274944)
@@ -1554,19 +1554,31 @@
[uiDelegate _webView:self editorStateDidChange:dictionaryRepresentationForEditorState(_page->editorState())];
}
-- (WKNavigation *)loadSimulatedRequest:(NSURLRequest *)request withResponse:(NSURLResponse *)response responseData:(NSData *)data
+- (WKNavigation *)loadSimulatedRequest:(NSURLRequest *)request response:(NSURLResponse *)response responseData:(NSData *)data
{
return wrapper(_page->loadSimulatedRequest(request, response, { static_cast<const uint8_t*>(data.bytes), data.length }));
}
-- (WKNavigation *)loadSimulatedRequest:(NSURLRequest *)request withResponseHTMLString:(NSString *)string
+// FIXME(223658): Remove this once adopters have moved to the final API.
+- (WKNavigation *)loadSimulatedRequest:(NSURLRequest *)request withResponse:(NSURLResponse *)response responseData:(NSData *)data
{
+ return [self loadSimulatedRequest:request response:response responseData:data];
+}
+
+- (WKNavigation *)loadSimulatedRequest:(NSURLRequest *)request responseHTMLString:(NSString *)string
+{
NSData *data = "" dataUsingEncoding:NSUTF8StringEncoding];
auto response = adoptNS([[NSURLResponse alloc] initWithURL:request.URL MIMEType:@"text/html" expectedContentLength:string.length textEncodingName:@"UTF-8"]);
- return [self loadSimulatedRequest:request withResponse:response.get() responseData:data];
+ return [self loadSimulatedRequest:request response:response.get() responseData:data];
}
+// FIXME(223658): Remove this once adopters have moved to the final API.
+- (WKNavigation *)loadSimulatedRequest:(NSURLRequest *)request withResponseHTMLString:(NSString *)string
+{
+ return [self loadSimulatedRequest:request responseHTMLString:string];
+}
+
- (WKNavigation *)loadFileRequest:(NSURLRequest *)request allowingReadAccessToURL:(NSURL *)readAccessURL
{
auto URL = ""
Modified: trunk/Tools/ChangeLog (274943 => 274944)
--- trunk/Tools/ChangeLog 2021-03-24 16:59:39 UTC (rev 274943)
+++ trunk/Tools/ChangeLog 2021-03-24 17:03:09 UTC (rev 274944)
@@ -1,3 +1,16 @@
+2021-03-24 Brent Fulgham <bfulg...@apple.com>
+
+ [Cocoa] Revise loadSimulatedRequest API with final review comments (223657)
+ https://bugs.webkit.org/show_bug.cgi?id=223657
+ <rdar://75757727>
+
+ Reviewed by Alex Christensen.
+
+ Update tests to use the final API, while still exercising the existing API.
+
+ * TestWebKitAPI/Tests/WebKitCocoa/WKWebViewLoadAPIs.mm:
+ (TEST):
+
2021-03-23 Kate Cheney <katherine_che...@apple.com>
Service worker loads are not marked as app-bound
Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebViewLoadAPIs.mm (274943 => 274944)
--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebViewLoadAPIs.mm 2021-03-24 16:59:39 UTC (rev 274943)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebViewLoadAPIs.mm 2021-03-24 17:03:09 UTC (rev 274944)
@@ -50,7 +50,13 @@
NSURLRequest *loadRequest = [NSURLRequest requestWithURL:exampleURL];
+ [webView loadSimulatedRequest:loadRequest responseHTMLString:htmlString];
+ [delegate waitForDidFinishNavigation];
+
+ALLOW_DEPRECATED_DECLARATIONS_BEGIN
+ // FIXME(223658): Remove this once adopters have moved to the final API.
[webView loadSimulatedRequest:loadRequest withResponseHTMLString:htmlString];
+ALLOW_DEPRECATED_DECLARATIONS_END
[delegate waitForDidFinishNavigation];
}
@@ -66,7 +72,13 @@
NSData *data = "" dataUsingEncoding:NSUTF8StringEncoding];
auto response = adoptNS([[NSURLResponse alloc] initWithURL:exampleURL MIMEType:@"text/HTML" expectedContentLength:[data length] textEncodingName:@"UTF-8"]);
+ [webView loadSimulatedRequest:loadRequest response:response.get() responseData:data];
+ [delegate waitForDidFinishNavigation];
+
+ALLOW_DEPRECATED_DECLARATIONS_BEGIN
+ // FIXME(223658): Remove this once adopters have moved to the final API.
[webView loadSimulatedRequest:loadRequest withResponse:response.get() responseData:data];
+ALLOW_DEPRECATED_DECLARATIONS_END
[delegate waitForDidFinishNavigation];
}
@@ -92,11 +104,11 @@
[webView setNavigationDelegate:delegate.get()];
NSURLRequest *loadRequest = [NSURLRequest requestWithURL:exampleURL];
- [webView loadSimulatedRequest:loadRequest withResponseHTMLString:htmlString];
+ [webView loadSimulatedRequest:loadRequest responseHTMLString:htmlString];
[delegate waitForDidFinishNavigation];
NSURLRequest *loadRequest2 = [NSURLRequest requestWithURL:exampleURL2];
- [webView loadSimulatedRequest:loadRequest2 withResponseHTMLString:htmlString2];
+ [webView loadSimulatedRequest:loadRequest2 responseHTMLString:htmlString2];
[delegate waitForDidFinishNavigation];
WKBackForwardList *list = [webView backForwardList];
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes