Bug 221430

Summary: Create stub methods to support finer-grained control over loading
Product: WebKit Reporter: Brent Fulgham <bfulgham>
Component: WebKit APIAssignee: Brent Fulgham <bfulgham>
Status: RESOLVED FIXED    
Severity: Normal CC: achristensen, andersca, bfulgham, cdumez, darin, ggaren, mjs, sam
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 221641    
Attachments:
Description Flags
Patch
none
Patch none

Brent Fulgham
Reported 2021-02-04 15:24:40 PST
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.
Attachments
Patch (14.91 KB, patch)
2021-02-05 10:54 PST, Brent Fulgham
no flags
Patch (13.84 KB, patch)
2021-02-09 16:09 PST, Brent Fulgham
no flags
Brent Fulgham
Comment 1 2021-02-04 15:25:40 PST
Brent Fulgham
Comment 2 2021-02-05 10:54:08 PST
Brent Fulgham
Comment 3 2021-02-09 16:09:29 PST
Geoffrey Garen
Comment 4 2021-02-09 16:50:17 PST
Comment on attachment 419781 [details] Patch r=me Tag! You're it for TBA macro duty now :P
Geoffrey Garen
Comment 5 2021-02-09 16:51:05 PST
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.)
EWS
Comment 6 2021-02-10 07:59:05 PST
Committed r272654: <https://commits.webkit.org/r272654> All reviewed patches have been landed. Closing bug and clearing flags on attachment 419781 [details].
Brent Fulgham
Comment 7 2021-02-10 09:23:17 PST
(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.
Darin Adler
Comment 8 2021-02-10 11:14:39 PST
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.
Alex Christensen
Comment 9 2021-02-10 11:19:59 PST
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.
Note You need to log in before you can comment on or make changes to this bug.