diff --git a/js/src/cross_framing_protection.js b/js/src/cross_framing_protection.js index c43e7958e6..161c68d4c5 100644 --- a/js/src/cross_framing_protection.js +++ b/js/src/cross_framing_protection.js @@ -2,7 +2,7 @@ * Conditionally included if framing is not allowed. * @return {void} */ -window.crossFramingProtection = () => { +const crossFramingProtection = () => { if (window.allowThirdPartyFraming) { return; } @@ -20,3 +20,5 @@ window.crossFramingProtection = () => { styleElement.parentNode.removeChild(styleElement); }; + +export { crossFramingProtection }; diff --git a/js/src/main.js b/js/src/main.js index 1fdb296090..153b1db910 100644 --- a/js/src/main.js +++ b/js/src/main.js @@ -4,6 +4,7 @@ import { Functions } from './functions.js'; import { KeyHandlerEvents } from './keyhandler.js'; import { Navigation } from './navigation.js'; import { PageSettings } from './page_settings.js'; +import { crossFramingProtection } from './cross_framing_protection.js'; /* global Indexes */ @@ -21,7 +22,7 @@ $(document).on('ajaxError', AJAX.getFatalErrorHandler()); AJAX.registerTeardown('main.js', KeyHandlerEvents.off()); AJAX.registerOnload('main.js', KeyHandlerEvents.on()); -window.crossFramingProtection(); +crossFramingProtection(); AJAX.registerTeardown('config.js', window.Config.off()); AJAX.registerOnload('config.js', window.Config.on()); diff --git a/libraries/classes/Header.php b/libraries/classes/Header.php index ce9c888221..e2390c4c5b 100644 --- a/libraries/classes/Header.php +++ b/libraries/classes/Header.php @@ -141,7 +141,6 @@ class Header $this->scripts->addFile('index.php', ['route' => '/messages', 'l' => $GLOBALS['lang']]); $this->scripts->addFile('shared.js'); $this->scripts->addFile('menu_resizer.js'); - $this->scripts->addFile('cross_framing_protection.js'); $this->scripts->addFile('config.js'); $this->scripts->addFile('indexes.js'); $this->scripts->addFile('common.js'); diff --git a/libraries/classes/Scripts.php b/libraries/classes/Scripts.php index bf200308df..eafeb65be9 100644 --- a/libraries/classes/Scripts.php +++ b/libraries/classes/Scripts.php @@ -92,8 +92,7 @@ class Scripts && ! str_contains($filename, 'index.php') && ! str_contains($filename, 'shared.js') && ! str_contains($filename, 'datetimepicker.js') - && ! str_contains($filename, 'validator-messages.js') - && ! str_contains($filename, 'cross_framing_protection.js'); + && ! str_contains($filename, 'validator-messages.js'); } /** diff --git a/test/classes/HeaderTest.php b/test/classes/HeaderTest.php index 4cf4af8869..b153e11f67 100644 --- a/test/classes/HeaderTest.php +++ b/test/classes/HeaderTest.php @@ -263,7 +263,6 @@ class HeaderTest extends AbstractTestCase ['name' => 'index.php', 'fire' => 0], ['name' => 'shared.js', 'fire' => 0], ['name' => 'menu_resizer.js', 'fire' => 1], - ['name' => 'cross_framing_protection.js', 'fire' => 0], ['name' => 'config.js', 'fire' => 1], ['name' => 'indexes.js', 'fire' => 1], ['name' => 'common.js', 'fire' => 1], diff --git a/webpack.config.cjs b/webpack.config.cjs index 2f2a647c09..54714b677f 100644 --- a/webpack.config.cjs +++ b/webpack.config.cjs @@ -16,7 +16,6 @@ module.exports = [ 'common': './js/src/common.js', 'config': './js/src/config.js', 'console': { import: './js/src/console.js', library: { name: 'Console', type: 'window', export: 'Console' } }, - 'cross_framing_protection': './js/src/cross_framing_protection.js', 'datetimepicker': './js/src/datetimepicker.js', 'database/central_columns': './js/src/database/central_columns.js', 'database/events': './js/src/database/events.js',