Environment: Glassfish 4.1.1, JSF 2.2.12, Omnifaces 2.3, Primefaces 5.3
The next are needed to reproduce the problem:
When F5 is pressed the unload event is posted to the server which unloads the view and removes it from JSF view state map.
Immediately after the unload event a keyup event is posted to the server, but it does not find the view anymore and a ViewExpiredException is thrown.
Can't reproduce on Payara 188.8.131.52 (Mojarra 2.2.12), WildFly 10.0.0 (Mojarra 2.3.0-m05) nor Tomcat 8.0.35 (Mojarra 2.2.13).
Can you reproduce this on other servers too? Which webbrowser were you using?
I did not try with other servers.
The browser where this happens is Firefox 46.0.1.
On Chrome 50.0.2661.102 only one POST is sent (the one for unload). The POST corresponding to the keyup (for F5) is not sent.
Firefox after F5:
Chrome after F5:
Couldn't reproduce in Firefox 42. I couldn't update it to 46 as it's prepackaged with Linux Mint and no newer package was available. Which OS are you using?
I'm using Windows 8.1
I did not say explicitly that the input that has the <p:ajax event="keyup" delay="500" .../> has focus at the moment F5 key is pressed.
<p:ajax event="keyup" delay="500" .../>
I initially used <f:ajax> without delay. Still can't reproduce it when using delay and/or <p:ajax>. The field had focus all the time. When adding delay, I tried F5ing before and after the trigger. Both cases still work fine in both Firefox 42 and Chrome 47 (on Linux Mint 17.2 Rafaela). Will try Windows this weekend.
Do you have only the POST for the unload followed by the GET's or two POST's like in my screenshot of Firefox from above?
Only the unload (as expected). The keyup didn't trigger any POST on F5 (and therefore I never succeed to reproduce your problem).
I rechecked my configuration and I think the problem is related to how I pass control from the login page (index.xhtml) to the main page (MainPage.xhtml): I have a navigation rule with a navigation-case that did not have <redirect>true</redirect>.
After the login the shown URL ends in "index.xhtml". The POST's are correctly sent to view "MainPage.xhtml". On F5, the unload event is sent to the view "index.xhtml". As far as I see this is the reason that both events are sent.
Since I have added <redirect>true</redirect> to the navigation-case and "MainPage.xhtml" is used also for unload, the keyup event is no longer sent. I can't estimate at this moment, but this way I might have solved another possible problems.
As a conclusion I'd say that my bad configuration created the problem with one note: maybe the unload event could post to the same view as the one used by ajax calls?
Fix #259: Assume JSF form URL not window location during unload.
I can see the problem now. I have fixed it to not anymore assume window.location as unload target but instead JSF form action.
The fix is available in today's latest 2.4-SNAPSHOT. Can you give it a try and let me know if that indeed solves the problem for you.
#259: fix return type in jsdoc
Thank you for your help.
I'll check the fix and let you know.