Details
-
Bug
-
Resolution: Unresolved
-
Major
-
16.10.0
-
None
-
Unknown
-
Description
Steps to reproduce, with Chrome 158 or later:
- Edit a page with the realtime WYSIWYG editor (standalone or in-place), alone.
- Type some text and save, then type more text without saving.
- Leave the edit mode with Cancel (or by clicking a link, e.g. in the breadcrumb).
- Edit the same page again within the next minutes.
Expected: the editing session starts from the saved content, and you are editing alone.
Actual:
- the text discarded at step 3 is back in the editor;
- the realtime toolbar shows you as a coeditor of yourself (the previous editing session is still listed as a participant);
- depending on what the other participant does, the save is attributed to the wrong author, and the server logs IllegalStateException: Message will not be sent because the WebSocket session has been closed once Chrome finally drops the old page.
Cause
Chrome 158 no longer lets unload listeners keep a page out of the back/forward cache (bfcache), so the edit page, which used to be excluded because of the unload listeners registered by lock.js and fullScreen.js, is now frozen in the bfcache when the user navigates away instead of being destroyed. The editor is never destroyed, so it never leaves the realtime session, and its Netflux WebSocket stays open while the page is frozen. The next editing session therefore joins a channel where the previous session is still a member, and gets its state, including the uncommitted changes pushed to the channel on Cancel.
Verified with the functional tests of the realtime WYSIWYG editor, at the same commit and with the same artifacts:
- Chrome 157: all tests pass;
- Chrome 158: RealtimeWYSIWYGEditorIT editAlone, restoreUnsavedChanges and preventEmptyRevisions fail, and the test log contains the WebSocket error above;
- Chrome 158 with --disable-features=BackForwardCache: all tests pass.
A diagnostic test showed pagehide with persisted=true followed by freeze on Cancel, and a new in-place editing session listing two participants for the same user (the frozen one and itself), with the discarded text in the content. With the bfcache disabled, persisted=false, one participant, and the saved content.
This started failing the Chrome configurations of the environment tests on every branch on 2026-11-20, when the selenium/standalone-chrome:latest image moved from Chrome 157 to 158.
Fix
Leave the realtime session explicitly when the page is hidden for the bfcache (pagehide with persisted), and reload the page if it is restored from the bfcache (pageshow with persisted), since its editing session is no longer valid.
Attachments
Issue Links
- relates to
-
XWIKI-25830 BlockNote shows outdated content when editing again a page left while it was kept in the browser's back/forward cache
-
- Open
-
-
XWIKI-25833 Unsaved changes are not restored when coming back to the realtime WYSIWYG edit mode with the browser's Back button in Firefox
-
- Open
-