Add SPI to prevent preconnect
Created attachment 433596 [details] Patch
<rdar://problem/72995136>
Given the problem description that "the resource load delegate is not being called for any pre-connections", did you consider changing pre-connect loads to consult the resource load delegate? If so, can you share your thinking for why a separate setting for pre-connect loads is preferable?
Comment on attachment 433596 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=433596&action=review > Tools/TestWebKitAPI/Tests/WebKitCocoa/LoadInvalidURLRequest.mm:140 > +TEST(WebKit, LoadNSURLRequestWithProperty) Oops. This should not have been included here. Please review as if it weren't here, and it'll be removed before landing.
Geoff I'm not sure what you're saying. This has nothing to do with a resource load delegate. This adds a way to prevent preconnecting.
Created attachment 433630 [details] Patch
Ah, I read the radar and now I know what you're saying. The initial solution attempt was to do this through WKBundlePageResourceLoadClient, but I don't think we should solve this problem that way because we are trying to decrease use of the injected bundle, this solves the problem just as well, and this has no compatibility issues with existing users of WKBundlePageResourceLoadClient.
Two thoughts: 1. Does WKWebViewConfiguration._loadsFromNetwork prevent preconnect? (Seems like it should.) 2. If WKWebViewConfiguration._loadsFromNetwork prevents preconnect, is there any specific use case for this SPI, or should we just recommend adopting WKWebViewConfiguration._loadsFromNetwork instead? In my view, WKWebViewConfiguration._loadsFromNetwork is the better SPI, and something we should consider promoting to API. I'm open to practicality arguments about why we need an SPI specific to preconnect for the time being for some reason. But if WKWebViewConfiguration._loadsFromNetwork gets the job done, I'd prefer going down that route, either right now, or at least in the longer term. So, I'll say r+ here because it's just SPI and it's not harmful or anything, bug please consider WKWebViewConfiguration._loadsFromNetwork as an alternative before landing.
*** This bug has been marked as a duplicate of bug 228044 ***