Bug #99286
closedPreview javascript broken in multidomain projects (regression)
100%
Description
Regression introduced in #93706:
The usual behavior:
- When clicking the preview button from the backend, the previewed page will be shown in a new tab
- When clicking the preview button again, the same frontend tab will be reloaded with the new url / changes.
This even worked in a multidomain setup, when the TYPO3 backend domain is different to the frontend domain.
Since the fix in #93706, in a multidomain setup, the reloading of the preview tab would fail because of a cross origin error:
WindowManager.js?bust=4008ca4684026deac234035bd2382cad44143af8:13
Uncaught (in promise) DOMException: Blocked a frame with origin "https://backend-domain.at" from accessing a cross-origin frame.
at t._localOpen (https://backend-domain.at/typo3/sysext/backend/Resources/Public/JavaScript/WindowManager.js?bust=4008ca4684026deac234035bd2382cad44143af8:13:627)
at Object.localOpen (backend-domain.at/typo3/sysext/backend/Resources/Public/JavaScript/WindowManager.js?bust=4008ca4684026deac234035bd2382cad44143af8:13:406)
at backend-domain.at/typo3/sysext/backend/Resources/Public/JavaScript/Element/ImmediateActionElement.js?bust=4008ca4684026deac234035bd2382cad44143af8:13:2559
Particularily these changes appear to break the behaviour:
https://review.typo3.org/c/Packages/TYPO3.CMS/+/75492/9/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/WindowManager.ts#b38
Updated by Georg Ringer almost 2 years ago
- Related to Bug #93706: Content element "View" button does not reload page added
Updated by Alen Bilalovic over 1 year ago
Hi, Is there any update on this issue?
Having the same problem in our installations.
Thanks
Updated by Christian Eßl over 1 year ago
The main problem in the changes from #93706 is this line:
const isInstanceOfWindow = existingWindow.constructor.name === 'Window';
This line will trigger a cross origin error.
Blocked a frame with origin "http://t3coredev.ddev.site" from accessing a cross-origin frame
I am no expert on Javascript, but here is a post, that describes in detail, how troublesome checking the type of an object can be between different windows. Both "x instanceof Window", that #93706 removes and the constructor name check are problematic:
https://stackoverflow.com/questions/332422/get-the-name-of-an-objects-type#answer-332429
Updated by Gerrit Code Review over 1 year ago
- Status changed from New to Under Review
Patch set 1 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/78021
Updated by Gerrit Code Review over 1 year ago
Patch set 2 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/78021
Updated by Gerrit Code Review over 1 year ago
Patch set 3 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/78021
Updated by Gerrit Code Review over 1 year ago
Patch set 4 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/78021
Updated by Christian Eßl over 1 year ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset 52faa67923996b283197fa0c0d0775f287e7d482.
Updated by Gerrit Code Review over 1 year ago
- Status changed from Resolved to Under Review
Patch set 1 for branch 11.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/78571
Updated by Christian Eßl over 1 year ago
- Status changed from Under Review to Resolved
Applied in changeset 67b2545e49f0ae4ef6aaba20726fa8ea8f2e9242.