Bug 24741 - Add (better?) support for cached form submissions
Summary: Add (better?) support for cached form submissions
Alias: None
Product: WebKit
Classification: Unclassified
Component: Page Loading (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Darin Fisher (:fishd, Google)
Depends on:
Reported: 2009-03-21 10:14 PDT by Darin Fisher (:fishd, Google)
Modified: 2009-03-23 13:49 PDT (History)
3 users (show)

See Also:

v1 patch (4.11 KB, patch)
2009-03-21 16:12 PDT, Darin Fisher (:fishd, Google)
koivisto: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Darin Fisher (:fishd, Google) 2009-03-21 10:14:29 PDT
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.
Comment 1 Darin Fisher (:fishd, Google) 2009-03-21 16:12:10 PDT
Created attachment 28826 [details]
v1 patch

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.
Comment 2 Darin Fisher (:fishd, Google) 2009-03-21 16:15:49 PDT
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 3 Antti Koivisto 2009-03-23 13:46:34 PDT
Comment on attachment 28826 [details]
v1 patch

Comment 4 Darin Fisher (:fishd, Google) 2009-03-23 13:49:12 PDT
Landed as:  http://trac.webkit.org/changeset/41919