Review 14.3 Merged

96725[TASK] Unify the top level window access

Benjamin Kott CR +2 V +2 Expert +766 −383 updated 10/15/26, 15:42

Commit message

Modules reached the top level window by hand across the JavaScript
stack, in different spellings and mostly unguarded, and told whether
they ran in a frame by comparing their location with the parent's.
@typo3/core/utility/top-window now provides topWindow and topDocument
for this, and openerTopWindow() for a window opened by another one.

topWindow is the outermost window carrying the TYPO3 object. That is
not `top` where an application embeds the backend, and an embedding
window may be of another origin where the clickjacking protection
header has been lifted for it. The lookup therefore stops at the first
window it is not allowed to read. It is resolved once per document,
because the windows above a frame keep their documents as long as the
frame exists. An opener can navigate or close while the window it
opened lives, so openerTopWindow() is resolved on every call. Any site
may be that opener, since the backend sends no
Cross-Origin-Opener-Policy, and the date picker used to throw on one.

`Window.top` is typed nullable, so strictNullChecks reports every bare
`top.` as an error, and topWindow clears that group in one place. An
application embedding the backend leaves `top.TYPO3` undefined, which
turned every unguarded lookup into a TypeError. Modal, Notification,
Severity, LoginRefresh and the persistent storage now share their
instance through topWindow as well, and the login mask and the
installer redirect topWindow, so they no longer navigate an embedding
application away.

Whether a module runs in a frame is now the question whether a window
carrying TYPO3 sits above it. Asked of any frame, the embedded backend
window answered it for itself: the sudo mode verification dispatched
itself again instead of opening its modal, and the install tool
rendered its messages into the embedding document.

The user settings reach the persistent storage as a global assignment,
which runs before any module, rather than through a module instruction.
The content navigation read them before that instruction had run and
fetched them again with a synchronous request, and modules in frames
did the same with an instance of their own. Neither happens any longer.

The clipboard panel no longer depends on the top level window at all.
The record list and the file list hand it the URL it posts to, so the
panel also works in a module opened in a tab of its own, where it
failed before.

Review

  • Code review CR +2 Done
    • Benjamin Kott +2
  • Verified V +2 Done
    • Benjamin Kott +2
    • core-ci +1 CI

Issues 1

Files 174

Show 154 more files

Review log 57

  1. Benjamin Kott commented on patch set 1 10/15/26, 14:16

    Cherry Picked from branch main. The following files contain Git conflicts: * typo3/sysext/backend/Resources/Public/JavaScript/drag-uploader.js * typo3/sysext/backend/Resources/Public/JavaScript/element-browser.js * typo3/sysext/backend/Resources/Public/JavaScript/element/editable-page-title.js * typo3/sysext/backend/Resources/Public/JavaScript/form-engine.js * typo3/sysext/backend/Resources/Public/JavaScript/login-refresh.js * typo3/sysext/backend/Resources/Public/JavaScript/new-record-wizard.js * typo3/sysext/backend/Resources/Public/JavaScript/notification.js * typo3/sysext/recycler/Resources/Public/JavaScript/recycler.js * typo3/sysext/workspaces/Resources/Public/JavaScript/backend.js * typo3/sysext/workspaces/Resources/Public/JavaScript/preview.js
  2. core-ci voted on patch set 1 V -1 10/15/26, 15:04 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/111204

  3. Benjamin Kott uploaded patch set 2 V -1 10/15/26, 15:12

  4. core-ci voted on patch set 2 V +1 10/15/26, 15:20 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/111216

  5. Benjamin Kott commented on patch set 2 10/15/26, 15:25

    This change is ready for review.
  6. Benjamin Kott voted on patch set 2 CR +2 V +2 10/15/26, 15:42

  7. Benjamin Kott merged patch set 3 10/15/26, 15:42