The Cocoa API for loading content through file URLs, NSData objects, and HTML strings lack the same context provided for NSURLRequests. This is unfortunate because NSURLRequest supports hinting to the networking subsystem about things like 'allowsConstrainedNetworkAccess' (indicates whether connections may use the network when the user has specified Low Data Mode), or 'allowsExpensiveNetworkAccess' (connections may use a network interface that the system considers expensive), and 'networkServiceType' (hints if the content is video, text, voice, etc.) This first patch adds stubs for a proposed API that calls into the existing load features. Subsequent patches will expand the logic to thread state properly.
<rdar://problem/73999547>
Created attachment 419434 [details] Patch
Created attachment 419781 [details] Patch
Comment on attachment 419781 [details] Patch r=me Tag! You're it for TBA macro duty now :P
I think we want a follow-up with a test to confirm that these new methods do in fact produce back-forward list items. (Might need to write a little code to make that the case.)
Committed r272654: <https://commits.webkit.org/r272654> All reviewed patches have been landed. Closing bug and clearing flags on attachment 419781 [details].
(In reply to Geoffrey Garen from comment #5) > I think we want a follow-up with a test to confirm that these new methods do > in fact produce back-forward list items. (Might need to write a little code > to make that the case.) Filed Bug 221641 to take this action.
Comment on attachment 419781 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=419781&action=review > Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm:2112 > + NSURLResponse *response = [[NSURLResponse alloc] initWithURL:request.URL MIMEType:@"text/html" expectedContentLength:string.length textEncodingName:@"UTF-8"]; Looks like this will leak. Need to release or autorelease.
Comment on attachment 419781 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=419781&action=review > Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebViewLoadAPIs.mm:49 > + [delegate waitForDidFinishNavigation]; This test doesn't verify that the string was loaded instead of the content of example.com. I'd load <body onload='alert(window.location)'/> and use _test_waitForAlert to make sure things are as you expect. > Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebViewLoadAPIs.mm:65 > + [delegate waitForDidFinishNavigation]; ditto > Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebViewLoadAPIs.mm:79 > + EXPECT_WK_STREQ(webView.get()._resourceDirectoryURL.path, file.URLByDeletingLastPathComponent.path); You may as well check [webView URL] also.