Closed Bug 1279050 Opened 10 years ago Closed 10 years ago

Scroll position and/or history is not retained after loading a redirected page

Categories

(Core :: DOM: Navigation, defect)

50 Branch
defect
Not set
major

Tracking

()

RESOLVED FIXED
Tracking Status
firefox49 --- unaffected
firefox50 + fixed

People

(Reporter: Fanolian+BMO, Assigned: dragana)

References

Details

(Keywords: regression, Whiteboard: btpp-active)

Attachments

(1 file, 1 obsolete file)

User Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:50.0) Gecko/20100101 Firefox/50.0 Build ID: 20160608030219 Steps to reproduce: 1. Load https://www.mozilla.org/contact/ . It should redirect to one of the locales, e.g. https://www.mozilla.org/en-US/contact/ 2. Do one of the following: 2a. Scroll down. Reload the page; or 2b. Scroll down. Left-click "I have questions about using Mozilla’s trademarks" so it opens in the same tab. Press Back; or 2c. Scroll down, then paste https://www.mozilla.org/en-US/foundation/trademarks/policy/ into URL bar and navigate to it. Press Back. Actual results: Scroll positions are not remembered for all cases. As for 2b and 2c, the history of last page is lost so I cannot press Forward.
[Tracking Requested - why for this release]: Regression
Severity: normal → major
Status: UNCONFIRMED → NEW
Ever confirmed: true
Flags: needinfo?(dd.mozilla)
Keywords: regression
Assignee: nobody → dd.mozilla
Status: NEW → ASSIGNED
Flags: needinfo?(dd.mozilla)
Component: Networking: Cache → Document Navigation
The code that needs to be change is here: http://mxr.mozilla.org/mozilla-central/source/docshell/base/nsDocShell.cpp#7466 probably checking if redirect is to the uri we are reloading...
Attached patch bug_1279050_v1.patch (obsolete) — — Splinter Review
bz, you are the right person to review this. Sorry for needinfo you, when you have time can you take a look. I am not 100% sure is the the right place. It fixes the problem, but I am not sure of side paths. Thanks.
Flags: needinfo?(bzbarsky)
I'm not sure of the various side-effects either. This is the first time I've seen this code in OnRedirectStateChange, and I'm not entirely sure what it's trying to do. Olli, do you know what this stuff is about? Dragana, what is the general goal of the patch? Are there no places between the redirect notification and STATE_STOP that examine mLoadType?
Flags: needinfo?(bzbarsky) → needinfo?(bugs)
I'll be away this evening. I'll try to remember to look at this tomorrow. I vaguely recall looking at some of the redirect stuff while fixing session history couple of years ago.
(In reply to Boris Zbarsky [:bz] from comment #6) > I'm not sure of the various side-effects either. This is the first time > I've seen this code in OnRedirectStateChange, and I'm not entirely sure what > it's trying to do. > > Olli, do you know what this stuff is about? > > Dragana, what is the general goal of the patch? > On redirect if a load was a reload or history load, we use to change loadType to LOAD_NORMAL_REPLACE. In bug 968273, I have changed to do the reload from originalURI. This will do a redirect again which triggers the changing loadType to LOAD_NORMAL_REPLACE but it should not. I could do the check in nsDocShell::OnRedirectStateChange but there could be multiples redirects (except we save all of them) > Are there no places between the redirect notification and STATE_STOP that > examine mLoadType? I figure out this is not a right place :( I need notification when all redirects are done, probably when we get the first non-redirect response. Any suggestions? Thanks
Whiteboard: btpp-active
Option 1 is to remember all the redirects and if the chain mismatch consider reload to be a new load. Option 2 I have tried with OnStateChange/OnStatusChange but they are sent to late. Option 3: The first nsDocShell function that is called when new content arrives (when redirects are finished) is CreateContentViewer. It is possible to do checks there but this is not covering all cases, e.g. when an error page is loaded. So I do not like option 1, option 2 does not work. So option 3 - to find a common place for all code paths.
I added a function that is called when OnStartRequest is called. If we get OnStartRequest to the new channel redirect is completed and we can compare URIs.
Attachment #8761583 - Attachment is obsolete: true
Attachment #8764355 - Flags: review?(bugs)
Flags: needinfo?(bugs)
Tracking 50+ for this regression in scroll history.
(sorry, reviewing this may take some time since reviewing this means that one needs to review also bug 968273)
and note to myself, need to look at bug 536466 too.
Dragana, could you perhaps answer to https://bugzilla.mozilla.org/show_bug.cgi?id=968273#c43 and explain how our behavior changed there and what other browsers do. (location.reload takes an optional bool param, which affects the behavior too)
Flags: needinfo?(dd.mozilla)
Comment on attachment 8764355 [details] [diff] [review] bug_1279050_v1.patch I was testing the behavior a bit, and it is unclear to me why bug 968273 is a safe change. Please explain, and ask review again for this patch, or back out the patch for bug 968273 and then we'll need possibly different fix for that bug (something which doesn't affect to history API behavior).
Attachment #8764355 - Flags: review?(bugs)
Flags: needinfo?(dd.mozilla)
bug 968273 backed out.
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Based on the backout assuming the problem is fixed in 50, updating status flag to reflect that.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: