WebKit will terminate the WebProcess if it encounters an unexpected file URL.
The termination happens for some WebKit clients that are only meant to render local content. If one of these clients (working with on-file content) is asked to redirect to a non-existing file URL, we shut down the WebProcess. We should just prevent these clients from allowing a refresh/redirect at all, since we only want to render some local static content.
Created attachment 281405 [details] Patch
Attached an initial idea that works for my specific error case.
<rdar://problem/18783614>
It might be better to create a specific setting for this that clients could use to control this behavior, rather than looking for specific keys in the user data dictionary.
Comment on attachment 281405 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=281405&action=review I don't think this is the right approach - it only closes one loophole from what I can tell. > Source/WebKit2/WebProcess/cocoa/WebProcessCocoa.mm:201 > + if (auto* initializationUserData = parameters.initializationUserData.object()) { > + RetainPtr<id> objCInitializationUserData; > + if (initializationUserData->type() == API::Object::Type::ObjCObjectGraph) { > + objCInitializationUserData = static_cast<ObjCObjectGraph*>(initializationUserData)->rootObject(); > + if (auto* dictionary = (NSDictionary *)objCInitializationUserData.get()) { > + if ([dictionary objectForKey: @"CanLoadRemoteResources"]) > + SecurityPolicy::setAllowRedirects(false); > + } > + } > + } The user initialization data is not the right place for this.
Comment on attachment 281405 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=281405&action=review >> Source/WebKit2/WebProcess/cocoa/WebProcessCocoa.mm:201 >> + } > > The user initialization data is not the right place for this. We could add a WebProcess initialization flag to indicate this use case. Would that be reasonable? The only negative with that approach is I would need to get the client application to modify their logic to set the flag properly.
Actually, after talking to Anders about this, I realize that this is not needed at all. The caller should be configuring their WebView using WKPreferencesSetHTTPEquivEnabled (false).