Chromium Code Reviews
DescriptionChanging scroll and view state in onpopstate shouldn't overwrite back/forward state restore
FrameLoader::SaveScrollState attempts to avoid clobbering state that
will be used for a back/forward restore by checking the committed
DocumentLoader::LoadType(). As of https://codereview.chromium.org/2653673006,
same-document navigations don't modify that load type, so a same-document
back-forward navigation can get its scroll state clobbered by creative
use of an onpopstate event handler.
Store the needed state on the stack, so that even if onpopstate does
trigger a SaveScrollState(), we can still restore. This also pulls
scroll and view state out into a helper class of HistoryItem. This
object is nullptr until state is saved for the first time, so we don't
need a bool to track whether the state is default or real.
BUG=734276
TEST=fast/history/change-viewport-height-in-onpopstate.html
Review-Url: https://codereview.chromium.org/2949073002
Cr-Commit-Position: refs/heads/master@{#487706}
Committed: https://chromium.googlesource.com/chromium/src/+/64015d479a86f06c19cac283a6e6214b38d1db10
Patch Set 1 #Patch Set 2 : Have a helper class for ScrollAndViewState, stash it before onpopstate #Patch Set 3 : +test #
Total comments: 10
Patch Set 4 : Non-GarbageColllected ViewState #
Total comments: 2
Patch Set 5 : Reset ViewState when trying to copy from a nullptr #Messages
Total messages: 40 (28 generated)
|