Safari 12 window.name changes when return to the same page (vaadin 7)
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 1.8k
- Forks
- 717
- Avg merge
- 2d 6h
- Merged PRs (30d)
- 3
Description
Vaadin Framework version
7.7.15
Browser version
Safari 12.0 (13606.2.11), it started with Safari v11.1.2
Description of the bug
If the @PreserveOnRefresh annotation is present in the UI, everytime I refresh the page, the same UI should be fetched from the VaadinRequest.
The UI is stored in a hashmap, and the unique key for the UI is: windowName + '.' + appId (UIInitHandler.java:258).
It works because vaadinBoostrap.js creates two parameters v-wn and v-appId and then passes them to the server.
While v-appId keeps the same value during all the lifecycle of the session, the v-wn is subject to change, so it can't be reliable for this purpose.
Minimal reproducible example
Open the app in Safari 12.0, click on menu Develop->Show web inspector and click on the Console tab.
Write "window.name" and Enter.
Now type www.google.com in the address bar and hit Enter. When the google page is loaded, click on the back button to go in the previous page.
Now if you write again "window.name" in the console, you get an empty string. This makes vaadinBootstrap.js generate a new value of window.name, and the server is not able to fetch the same UI from the HashMap (UIInitHandler.java:170).
If you try to reproduce the same steps with Chrome or Firefox, the window.name variable has the same value as before switching to google.com, and the previuous UI gets returned.
Expected behavior
Reload the same UI after coming back to the app page, after switching to external page.
Actual behavior
window.name returns an empty string, so a new UI gets generated, so you lose the old one.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the Safari 12 behavior described in the issue, then inspect vaadinBootstrap.js and UIInitHandler.java at lines 170 and 258 to trace how window.name and appId identify the UI. Done means returning to the app after visiting an external page restores the existing UI instead of creating a new one, while preserving the behavior reported for Chrome and Firefox.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, javascript
- Domain
- full-stack
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100