Open Bug 1067814 Opened 10 years ago Updated 2 years ago

location.href seems to miss PHP sessions

Categories

(Core :: General, defect)

32 Branch
x86
macOS
defect

Tracking

()

UNCONFIRMED

People

(Reporter: mrgingles, Unassigned)

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_4) AppleWebKit/537.78.2 (KHTML, like Gecko) Version/7.0.6 Safari/537.78.2

Steps to reproduce:

Sent an Ajax call to a PHP page (we'll call it X) which creates some sessions. 


Actual results:

The PHP page (X) correctly created the sessions and asked the success of the ajax call to go to another page (we'll call it Y) using "location.href"


Expected results:

The page X correctly created the sessions, but they are not present in Y. The sessions should be present in Y.

PLEASE NOTE:
everything were working on FF 32.0 (stopped working in FF 32.0.1)
everything works in other browsers
everything works if I do the step avoiding the ajax call (and the location.href call)
NO CODE WAS CHANGED
Your range of 32.0 to 32.0.1 corresponds to http://hg.mozilla.org/releases/mozilla-release/pushloghtml?fromchange=44234f451065&tochange=1727a19db430, but I don't see anything in that list that would explain this behaviour :/
Repoter, could you test with a clean profile, please.
https://support.mozilla.org/en-US/kb/profile-manager-create-and-remove-firefox-profiles

If the issue is still here, could you provide a minimal self-contained testcase.
Flags: needinfo?(mrgingles)
Just created a new profile and it works just for the first time I try to set the sessions...
If I destroy the sessions and try again it no longer works (as previous described...)

I'm away from office at the moment, but I'll try to provide a test case as soon as possible.

(In reply to Loic from comment #2)
> Repoter, could you test with a clean profile, please.
> https://support.mozilla.org/en-US/kb/profile-manager-create-and-remove-
> firefox-profiles
> 
> If the issue is still here, could you provide a minimal self-contained
> testcase.
Ok, I think I got it.

I've done the testcase as requested, but everything worked REALLY fine. So the mystery of the strangeness that firefox suddenly lost sessions has deepened...

At this point I looked deeper inside my code and found this event: window.onbeforeunload = triggerBFUnload

In my case, triggerBFUnload is a function which clears sessions.

The event "window.onbeforeunload" is triggered every time I use "location.href" to redirect the browser to another page. 

Now I'm sure that the sessions are NOT cleared by Firefox (which seems obvious, since Firefox should be not able to do something like this all alone...) but they are cleaned by a PHP page. Now the problem is: why Firefox called the window.onbeforeunload event when I use "location.href"?

REMEMBER: This never happened before FF 32.0.1. 
IE7 and IE8 have this behavior too, so I think it's a bug ;)

Just in case it's not clear, here is your testcase: http://vincenzomennella.it/firefox_testcase/

You'll find the script attached to this post.
Attached file firefox_testcase.zip
Flags: needinfo?(mrgingles)
> Now the problem is: why Firefox called the window.onbeforeunload event when I use
> "location.href"?

Uh..  That's expected.  If you're navigating, beforeunload will fire before the navigation.
Group: core-security
CC list accessible: false
Not accessible to reporter
CC list accessible: true
Accessible to reporter
Group: core-security
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: