Skip to content

Commit caf1989

Browse files
committed
Remove crossFramingProtection from the Window global
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
1 parent 332e27a commit caf1989

6 files changed

Lines changed: 6 additions & 7 deletions

File tree

‎js/src/cross_framing_protection.js‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* Conditionally included if framing is not allowed.
33
* @return {void}
44
*/
5-
window.crossFramingProtection = () => {
5+
const crossFramingProtection = () => {
66
if (window.allowThirdPartyFraming) {
77
return;
88
}
@@ -20,3 +20,5 @@ window.crossFramingProtection = () => {
2020

2121
styleElement.parentNode.removeChild(styleElement);
2222
};
23+
24+
export { crossFramingProtection };

‎js/src/main.js‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { Functions } from './functions.js';
44
import { KeyHandlerEvents } from './keyhandler.js';
55
import { Navigation } from './navigation.js';
66
import { PageSettings } from './page_settings.js';
7+
import { crossFramingProtection } from './cross_framing_protection.js';
78

89
/* global Indexes */
910

@@ -21,7 +22,7 @@ $(document).on('ajaxError', AJAX.getFatalErrorHandler());
2122
AJAX.registerTeardown('main.js', KeyHandlerEvents.off());
2223
AJAX.registerOnload('main.js', KeyHandlerEvents.on());
2324

24-
window.crossFramingProtection();
25+
crossFramingProtection();
2526

2627
AJAX.registerTeardown('config.js', window.Config.off());
2728
AJAX.registerOnload('config.js', window.Config.on());

‎libraries/classes/Header.php‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,6 @@ private function addDefaultScripts(): void
141141
$this->scripts->addFile('index.php', ['route' => '/messages', 'l' => $GLOBALS['lang']]);
142142
$this->scripts->addFile('shared.js');
143143
$this->scripts->addFile('menu_resizer.js');
144-
$this->scripts->addFile('cross_framing_protection.js');
145144
$this->scripts->addFile('config.js');
146145
$this->scripts->addFile('indexes.js');
147146
$this->scripts->addFile('common.js');

‎libraries/classes/Scripts.php‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,7 @@ private function hasOnloadEvent(string $filename): bool
9292
&& ! str_contains($filename, 'index.php')
9393
&& ! str_contains($filename, 'shared.js')
9494
&& ! str_contains($filename, 'datetimepicker.js')
95-
&& ! str_contains($filename, 'validator-messages.js')
96-
&& ! str_contains($filename, 'cross_framing_protection.js');
95+
&& ! str_contains($filename, 'validator-messages.js');
9796
}
9897

9998
/**

‎test/classes/HeaderTest.php‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,6 @@ public function testAddedDefaultScripts(): void
263263
['name' => 'index.php', 'fire' => 0],
264264
['name' => 'shared.js', 'fire' => 0],
265265
['name' => 'menu_resizer.js', 'fire' => 1],
266-
['name' => 'cross_framing_protection.js', 'fire' => 0],
267266
['name' => 'config.js', 'fire' => 1],
268267
['name' => 'indexes.js', 'fire' => 1],
269268
['name' => 'common.js', 'fire' => 1],

‎webpack.config.cjs‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ module.exports = [
1616
'common': './js/src/common.js',
1717
'config': './js/src/config.js',
1818
'console': { import: './js/src/console.js', library: { name: 'Console', type: 'window', export: 'Console' } },
19-
'cross_framing_protection': './js/src/cross_framing_protection.js',
2019
'datetimepicker': './js/src/datetimepicker.js',
2120
'database/central_columns': './js/src/database/central_columns.js',
2221
'database/events': './js/src/database/events.js',

0 commit comments

Comments
 (0)