When the CURL backend handle the 'download' of a local file, it does not perform the normal header processing for data received over the network. This means that the URL is not set properly, and the 'didReceiveResponse' processing is never performed.
This was the cause of an earlier bug in the write callback, as evidenced by the following comment:
// since the code in headerCallback will not have run for local files
// the code to set the URL and fire didReceiveResponse is never run,
// which means the ResourceLoader's response does not contain the URL.
// Run the code here for local files to resolve the issue.
// TODO: See if there is a better approach for handling this.
I have resolved the current error in the same fashion, by dealing with this special case and manually firing the 'didReceiveResponse'. This specialized handling is now in its own function which cleans things up a bit.
The current bug was demonstrated by LayoutTests/fast/encoding/char-encoding-mac.html.
Created attachment 34868 [details]
Correct crash due to improper handling of local files.
The problem here is actually in the POST handler. The proper fix seems to be
to add the 'didReceiveResponse' to the readCallback handler.
Further testing indicates the original patch actually was correct.
Landed in http://trac.webkit.org/changeset/47299.