Closed Bug 247660 Opened 20 years ago Closed 11 years ago

when refreshed after referral using onUnload reloads previous page

Categories

(Core :: DOM: Navigation, defect)

defect
Not set
normal

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: karsten, Unassigned)

References

()

Details

User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8a2) Gecko/20040615 Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8a2) Gecko/20040615 Using window.location to take the browser to another page, then reloading the page with the "reload" button, it jumps back to the previous page rather than reloading the current page. Reproducible: Always Steps to Reproduce: 1. goto karstenw.customer.netspace.net.au 2. click on submit ( takes you to a second page ) 3. click on the reload (refresh) button Actual Results: Reloaded the wrong page i.e. the previous one Expected Results: Reload the current page first.html <html><head> <script> var isSubmit = 0; function newpage(){ if(isSubmit ==1) { window.location = 'second.html'; } } function itIsSubmit(){ isSubmit = 1; } </script> </head> <body onUnload='newpage()'> <form onSubmit='itIsSubmit()'> <input type='submit' value='submit' /> </form> </body> </html> second.html <html><body>High There;)</body></html>
Works as expected in IE 6
Summary: reloads to previous page when referred using window.location → reloads to previous page when referred using window.location
Works as expected in Opera
Component: History: Session → DOM: Events
Summary: reloads to previous page when referred using window.location → refresh when referred using onUnload reloads previous page
Summary: refresh when referred using onUnload reloads previous page → when refreshed after referral using onUnload reloads previous page
This is a session history issue... I have no idea what's breaking here at the moment, though. I do wonder whether the onsubmit and all that jazz is needed or whether it's enough to set the location in onunload and leave the page via link click or just typing a new URI in the URL bar.
Component: DOM: Events → History: Session
Keywords: qawanted
*** Bug 253497 has been marked as a duplicate of this bug. ***
Per bug 253497 (see attachment there) the jazz is in fact unnecessary....
It looks like onunload fires _before_ docshell calls OnNewURI. So the sequence of events in docshell is the following: 1) Anchor load starts 2) location load starts 3) OnNewURI called for anchor load (setting mLSHE to the anchor page) 4) OnNewURI called for location load (since mLSHE is non-null, we don't add to session history). I can think of three possible solutions: I) Set mLSHE even if it's already set. I'm not sure what that would break, if anything, and for this case it would make the in-between page not be in session history at all. II) Call OnNewURI (or at least the session history parts of it) before calling onunload. That would put all three pages involved in SH. Again, not sure what other things would break. III) Disable setting location in onunload (we have existing bugs asking for this anyway). Thoughts?
Status: UNCONFIRMED → NEW
Ever confirmed: true
OS: Windows 2000 → All
Hardware: PC → All
*** Bug 307072 has been marked as a duplicate of this bug. ***
Depends on: CVE-2007-1095
Component: History: Session → Document Navigation
QA Contact: history.session → docshell
Tested this with the testcases in comment 0 on a webserver. WFM on FF 27.0a1 2013-10-10, Ubuntu 13.04.
Status: NEW → RESOLVED
Closed: 11 years ago
Keywords: qawanted
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.