Add (better?) support for cached form submissions
Presently, FrameLoader asks the network layer if it will serve a request from cache. That is a bit problematic for Chromium at least since the cache runs on a different thread such that an answer to that question now may not be valid later. Moreover, the bigger problem is that two identical form submissions could have different responses. So, it is not actually possible to determine from a ResourceRequest if a previous response to a similar ResourceRequest could be usable by this new one.
Instead, I think WebCore needs a solution like the one I implemented in Mozilla. For each form submission, a unique identifier should be generated. That unique identifier should be added to the ResourceRequest (to the FormData actually) so that the ResourceHandle can use that identifier in conjunction with the URL to generate a cache key that is unique to the form submission instance.
Since FormData is already stored in HistoryItem, this means that going back-n-forth through session history would result in providing the same FormData instance to ResourceHandle. That would allow it to serve up cached form submission data based on the identifier stored in the FormData object.
The only change required to cross-platform code is to add an identifier field to FormData.
Created attachment 28826 [details]
Pretty simple. For now, this adds code that will only be used by the Chromium port, but I didn't bother surrounding the code with #if PLATFORM(CHROMIUM) because I suspect that other ports will want to adopt this approach and the added code is very minor. I'm happy to add #ifdefs if that is preferred.
My plan is to follow-up this patch with some http layout tests that hit all of the interesting edge cases (like a non-idempotent form submitted twice with the same values).
Comment on attachment 28826 [details]
Landed as: http://trac.webkit.org/changeset/41919