We set up downloaded file name encoding via FrameLoader::addExtraFieldsToRequest(), and one of the options is referring document's encoding. But FrameLoader::addExtraFieldsToRequest() is called at poorly defined times, one of which is after policy delegate. If the download link is target="_blank", then this happens after a new tab opens, and we overwrite a perfectly good fallback encoding array with one from a blank document. <rdar://problem/14212635>
Created attachment 205056 [details] proposed fix
Comment on attachment 205056 [details] proposed fix This code is gross. This fix is good for this bug, though.
Committed <http://trac.webkit.org/r151793>.