[BUGFIX] Fix broken reload of save+preview links 18/54218/9
authorFrank Naegler <frank.naegler@typo3.org>
Tue, 26 Sep 2017 10:43:14 +0000 (12:43 +0200)
committerHelmut Hummel <typo3@helhum.io>
Fri, 29 Sep 2017 11:27:27 +0000 (13:27 +0200)
Resolves: #82456
Related: #81250
Releases: master
Change-Id: Idab208c3273adbd5800edab51bd9ca7bbec19af8
Reviewed-on: https://review.typo3.org/54218
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Andreas Fernandez <typo3@scripting-base.de>
Tested-by: Jasmina LieƟmann <code@frauliessmann.de>
Reviewed-by: Mathias Schreiber <mathias.schreiber@typo3.com>
Tested-by: Mathias Schreiber <mathias.schreiber@typo3.com>
Reviewed-by: Helmut Hummel <typo3@helhum.io>
Tested-by: Helmut Hummel <typo3@helhum.io>
typo3/sysext/backend/Classes/Utility/BackendUtility.php
typo3/sysext/backend/Tests/Unit/Utility/BackendUtilityTest.php

index 960d820..d050d02 100644 (file)
@@ -2581,7 +2581,8 @@ class BackendUtility
             }
         }
 
-        $onclickCode = 'var previewWin = window.open(' . GeneralUtility::quoteJSvalue($previewUrl) . ',\'newTYPO3frontendWindow\');' . ($switchFocus ? 'previewWin.focus();' : '');
+        $onclickCode = 'var previewWin = window.open(' . GeneralUtility::quoteJSvalue($previewUrl) . ',\'newTYPO3frontendWindow\');' . ($switchFocus ? 'previewWin.focus();' : '') . LF
+            . 'if (previewWin.location.href === ' . GeneralUtility::quoteJSvalue($previewUrl) . ') { previewWin.location.reload(); };';
         return $onclickCode;
     }
 
index 12a700f..da49363 100644 (file)
@@ -872,7 +872,8 @@ class BackendUtilityTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
         unset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_befunc.php']['viewOnClickClass']);
 
         $alternativeUrl = 'https://typo3.org/about/typo3-the-cms/the-history-of-typo3/#section';
-        $onclickCode = 'var previewWin = window.open(' . GeneralUtility::quoteJSvalue($alternativeUrl) . ',\'newTYPO3frontendWindow\');';
+        $onclickCode = 'var previewWin = window.open(' . GeneralUtility::quoteJSvalue($alternativeUrl) . ',\'newTYPO3frontendWindow\');' . LF
+            . 'if (previewWin.location.href === ' . GeneralUtility::quoteJSvalue($alternativeUrl) . ') { previewWin.location.reload(); };';
         $this->assertStringMatchesFormat(
             $onclickCode,
             BackendUtility::viewOnClick(null, null, null, null, $alternativeUrl, null, false)