I did some comparison running the test with and without no-store. The forms are restored via `nsGenericHTMLFormControlElementWithState::RestoreFormControlState`. This method uses `nsLayoutHistoryState::GetState` to retreive the state, then calls `HTMLInputElement::RestoreState`, which restores it's value from `PresState::contentData`. With no-store, `nsLayoutHistoryState::mScrollPositionOnly` is true, thus `GetState` will clear `PresState::contentData`. The check for no-store happens in `nsDocShell::ShouldDiscardLayoutState`. I'm unsure about the impact changes to `ShouldDiscardLayoutState` or `GetState` might have. From a quick test, disabling the no-store check in `ShouldDiscardLayoutState` will also allow bfcache with no-store. Bug 261312 discussed about removing the no-store check, but opted for WONTFIX for compatibility reasons with Chrome. Though Chrome is now in the process of changing their behavior, see [here](https://bugs.chromium.org/p/chromium/issues/detail?id=1228611). Alternatively, I guess `mScrollPositionOnly` refers to [#restore-persisted-state](https://html.spec.whatwg.org/#restore-persisted-state) and from my understanding, everything in `contentData` (see [PresState](https://searchfox.org/mozilla-central/source/layout/base/PresState.ipdlh)) falls under aspects that the UA previously had recorded in persisted user state, so it should be restored. Thus everything about `mScrollPositionOnly` could be removed. Though Bug 215405 introduced this flag explicitly to restore scroll position, but not form contents for no-store.
Bug 1825222 Comment 3 Edit History
Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.
I did some comparison running the test with and without no-store. The forms are restored via `nsGenericHTMLFormControlElementWithState::RestoreFormControlState`. This method uses `nsLayoutHistoryState::GetState` to retreive the state, then calls `HTMLInputElement::RestoreState`, which restores it's value from `PresState::contentData`. With no-store, `nsLayoutHistoryState::mScrollPositionOnly` is true, thus `GetState` will clear `PresState::contentData`. The check for no-store happens in `nsDocShell::ShouldDiscardLayoutState`. I'm unsure about the impact changes to `ShouldDiscardLayoutState` or `GetState` might have. From a quick test, disabling the no-store check in `ShouldDiscardLayoutState` will also allow bfcache with no-store. Bug 261312 discussed about removing the no-store check, but opted for WONTFIX for compatibility reasons with Chrome. Though Chrome is now in the process of changing their behavior, see [here](https://bugs.chromium.org/p/chromium/issues/detail?id=1228611). Alternatively, I guess `mScrollPositionOnly` refers to [#restore-persisted-state](https://html.spec.whatwg.org/#restore-persisted-state) and from my understanding, everything in `contentData` (see [PresState](https://searchfox.org/mozilla-central/source/layout/base/PresState.ipdlh)) falls under aspects that the UA previously had recorded in persisted user state, so it should be restored. Thus everything about `mScrollPositionOnly` could be removed. Though Bug 215405 introduced this flag explicitly to restore scroll position, but not form contents for no-store. :farre, you are a peer of session restore, can you comment on this?