Closed Bug 96230 Opened 23 years ago Closed 23 years ago

back button fails to restore scroll position on local file bookmarks.html

Categories

(Core :: DOM: Navigation, defect)

x86
Windows 95
defect
Not set
minor

Tracking

()

VERIFIED FIXED
mozilla0.9.6

People

(Reporter: MozillaUser, Assigned: radha)

References

Details

(Keywords: regression, Whiteboard: testcase only works when viewed from harddrive)

Attachments

(2 files, 1 obsolete file)

Using build 2001082008 on Windows 95 (First noticed in a 20010817 build)

View your bookmarks.html file. I am not talkign about viewing it in the sidebar
or the bookmarks menu or anything, I mean pick "Open File..." from the "File"
menu and open your bookmarks.html file from your profile

Scroll down a little bit, and click any link, and wait for whatever destination
page to load

Now click "back" and you will be taken to the top of the bookmarks.html file,
rather than whatever position you had scrolled down to

*** This bug has been marked as a duplicate of 58785 ***
Status: UNCONFIRMED → RESOLVED
Closed: 23 years ago
Resolution: --- → DUPLICATE
I disagree with this bug being marked duplicate of bug 58785

Although the symptom is similar, the description for that bug talks about pages
that contain a "large amount of varied content" and it has comments which talk
about reproducability only on complex table structures or only when using the
back button when the page has not fully loaded.

This bug is 100% reproducable on this simple bookmarks.html file with no tables
regardless of whether anything has finished loading or not. This bug is also
new, In the August 10 2001 build this worked fine
Status: RESOLVED → UNCONFIRMED
Resolution: DUPLICATE → ---
Adding the regression keyword

Please see bug 60075 for a description of symptoms very very sumilar to this bug
which have been mysteriously fixed and mysteriously regressed over and over and
over. The only reason I opened this bug instead of re-opening bug 60075 is
because the simplified testcase on that bug is no longer useful.
Keywords: regression
grrr... What on earth is happening?
My testcase attachment 46599 [details] will not reproduce the symptom, but when I view it
off my harddrive, it NEVER remembers the scroll position

Yarg. My head hurts.
Whiteboard: ignore that first testcase :(
Okay. This only happens when you view the bookmarks.html from a local file. It
does not work if you have loaded the bookmarks.html via http://

reducing severity, and adjusting the description for better accuracy
Severity: normal → minor
Summary: back button fails to restore scroll position on bookmarks.html → back button fails to restore scroll position on local file bookmarks.html and nobody cares except MozillaUser
Whiteboard: ignore that first testcase :( → testcase only works when viewed from harddrive
cc:evaughan
Summary: back button fails to restore scroll position on local file bookmarks.html and nobody cares except MozillaUser → back button fails to restore scroll position on local file bookmarks.html
evaughan, radha: any idea what's going on here?
Status: UNCONFIRMED → NEW
Ever confirmed: true
I will take a look t make sure that the problem is not session history or in
docshell.
Status: NEW → ASSIGNED
Target Milestone: --- → mozilla0.9.6
cc'ing darin.
Here's what's going on:

when a page is loaded from the local filesystem, cache is not creating a
cachetoken for it. If a page has no cacheToken, sessionhistory will not save
form values and scrollbar positions in it, because I understand cacheToken is
not created when a page has no-store directives in it. 

Darin,  why are cache tokens not created for local files? How can docshell
differentiate this scenario from a no-store situation? I guess this is one of
those situations where docshell or session history can use some convinience
routines from cache to arrive at right conclusions. 
local files are loaded via the file protocol.  nsFileChannel does not implement
nsICachingChannel because there is no caching involved.

you may simply want to check the URL scheme to determine if the URL references a
local file.  you could alternatively QI the nsIChannel to nsIFileChannel.
Darin, nsICachingChannel is created/not created  for which other protocols?
Attached patch patch to docshell (obsolete) — Splinter Review
ok, so you're special casing httpChannels that do not have a cache entry.  this
we know to correspond to data sent with a 'cache-control: no-store' header. 
this also could correspond to the case in which http caching has been disabled
(which can be controlled via a pref).  is this a problem?
Darin: That depends on what happens to back/forward operations when cache is
disabled.  if we would be hitting the servers for back/forward (when cache is
disabled) then the proposed patch will provide proper behavior. Otherwise, I
need other tools to distinguish this situation from 'cache-control:no store' cases.
radha: yes, when the cache is disabled, we should be hitting the server for
back/forward operation.
Comment on attachment 52598 [details] [diff] [review]
patch to docshell

sr=darin
Attachment #52598 - Flags: superreview+
*** Bug 103555 has been marked as a duplicate of this bug. ***
Nit: Don't you want to check for cacheChannel && !cacheToken?

This is irrelevent for now, since only http (and view-source) implements that
interface. (not sure why ftp doesn't - darin?)

Why do we not want to save the position for no-store, anyway?
radha: actually, we may also be hitting the server for back/forward even when
the cache is enabled and the server did not send 'cache-control: no-store' ...
perhaps, if we really want to disable saving the scroll position for no-store
content, then we should check the httpchannel for the 'cache-control: no-store'
header.  checking the cache entry only happens to correspond to the no-store
case right now... in the future, it could correspond to other cases as well.

however, come to think of it, i too am forgetting why we don't want to save the
scroll position for no-store content.  i think i may be missing something about
what the saveLayoutStateFlag attribute means.
Saving scrollbar position is currently tied with  saving form element values, 
done by the Presentation Shell. One call to PresShell does both the job. Since
form value restoration is not done on pages with 'cache-control: no store',
scroll bar position is also not saved and restored. Eric pollmann wrote that
code. Now that he is gone, I don't want to venture too much in to that area,
(atleast until I take care of my other important bugs)
make sense, but how about checking for the 'cache-control: no-store' header
directly, instead of inferring it from a NULL cacheToken?

  nsXPIDLCString val;
  httpChannel->GetResponseHeader("Cache-Control", getter_Copies(val));
  if (PL_strcasestr(val, "no-store"))
    entry->SetSaveLayoutStateFlag(PR_FALSE);
radha: This was done as part of the 6.1 just-before-release stuff for
cache-control: no-store (bug 93027)

The problem was that we were storing form data in session history, and then
going back reloaded form elements. Several fixes went onto the trunk after 6.1
(including basing this on the autocomplete attr, rather than the cache headers,
bug 93972). I do not know if it is still needed. We could take it out and see if
the relevent testcases still pass, I guess, but thats a separate bug.

However, after sicking/jkieser's form rewrite, this will all change anyway, I
suppose.
I have submitted a patch incorporating darin's suggestions. This patch works on
sites with cache control: no-store as well as in simple  ftp or directory viewer.
Comment on attachment 52786 [details] [diff] [review]
Updated patch

sr=darin
Attachment #52786 - Flags: superreview+
Attachment #52598 - Attachment is obsolete: true
Comment on attachment 52786 [details] [diff] [review]
Updated patch

r=adamlock
Attachment #52786 - Flags: review+
Fix checked in.
Status: ASSIGNED → RESOLVED
Closed: 23 years ago23 years ago
Resolution: --- → FIXED
This seems *partly* fixed testing with Build 2001101203 on Windows 95

Starting from my local bookmarks.html file, If I click on a link, let the page
load completely, and then click back, scroll position is remembered, but if I
click back  before the page finishes loading, when the barberpole is still
spinning, my scroll position is lost, and I end up back at the top of my
bookmarks.html file.
If Darin's comment in bug 104181 is correct, then in order for bug 104181 to
land on the 0.9.4 branch (which we want at this stage) this *also* has to land
on that branch.  Bug 104181 has PDT+; therefore this one may need that too.
We've got r | sr | on this.  Let's get PDT/a=.  I'm slapping a PDT+ on it; if
this poses problems, spam me.
Keywords: nsbranch
Whiteboard: testcase only works when viewed from harddrive → testcase only works when viewed from harddrive, PDT+
removing PDT+ -- waiting for jaimejr or others to do this.
Whiteboard: testcase only works when viewed from harddrive, PDT+ → testcase only works when viewed from harddrive
mass-verifying claudius' Fixed bugs which haven't changed since 2001.12.31.

if you think this particular bug is not fixed, please make sure of the following
before reopening:

a. retest with a *recent* trunk build.
b. query bugzilla to see if there's an existing, open bug (new, reopened,
assigned) that covers your issue.
c. if this does need to be reopened, make sure there are specific steps to
reproduce (unless already provided and up-to-date).

thanks!

[set your search string in mail to "AmbassadorKoshNaranek" to filter out these
messages.]
Status: RESOLVED → VERIFIED
Component: History: Session → Document Navigation
QA Contact: claudius → docshell
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: