Bug 10161 - REGRESSION: form state not restored when going back to a page with frames
Summary: REGRESSION: form state not restored when going back to a page with frames
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Frames (show other bugs)
Version: 420+
Hardware: Mac OS X 10.4
: P2 Normal
Assignee: Nobody
URL: http://www.math.ucla.edu/~jimc/html40...
Keywords:
Depends on:
Blocks:
 
Reported: 2006-07-30 11:26 PDT by Trey Matteson
Modified: 2007-05-24 18:45 PDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Trey Matteson 2006-07-30 11:26:42 PDT
Go to the above URL.  Click on "forms" link on the left to load the main frame with some content including forms.  Type something in one of the text fields.  Go to any other page (I did www.cnn.com).  Go back.  The form state is not restored.

Note the if you scroll before going to cnn.com, the scroll position is restored when you go back.  This also works if there are no frames involved.

This works in 10.4.7 (and my guess is it worked in a bunch of previous releases), but fails in TOT
  Last Changed Rev: 15648
  Last Changed Date: 2006-07-27 02:22:16 -0700 (Thu, 27 Jul 2006)
Comment 1 Trey Matteson 2006-08-02 16:37:28 PDT
I will be checking in some automated tests that are blocked by this bug.  When fixed, look through LayoutTests/http/tests/navigation/*disabled for this bug number.
Comment 2 mitz 2007-03-15 00:21:17 PDT
I cannot reproduce in TOT.
Comment 3 Matt Perry 2007-05-24 18:28:34 PDT
I just noticed this as well.  From stepping through the code, it looks like the documentState is available on the HistoryItem initially when you navigate back, but is overridden with empty data before it is restored.

Here's what I think is happening.  Since the frames don't exist yet when you hit Back, they need to be created.  FrameLoader::init() is called, creating an empty document for its new frame.  At this point, FrameLoader::restoreDocumentState() is called, to restore the document state of the original forms into the empty document.  This fails because the load is still provisional, and restoreDocumentState only grabs from the currentHistoryItem, which is NULL.

Then, when the Back navigation is committed, the document state for the empty document is saved onto the HistoryItem corresponding to the subframe with form data.  Shortly after, restoreDocumentState is called again, but by this point the documentState is already clobbered.