Remove crossFramingProtection from the Window global

Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
This commit is contained in:
Maurício Meneghini Fauth 2022-11-28 23:43:35 -03:00
parent 332e27ad39
commit caf19897ac
No known key found for this signature in database
GPG Key ID: 6A16FD38AFC89CC8
6 changed files with 6 additions and 7 deletions

View File

@ -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 };

View File

@ -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());

View File

@ -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');

View File

@ -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');
}
/**

View File

@ -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],

View File

@ -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',