Merge pull request #176 from mythmon/csp

[Bug 1195792] Move loading translations out of an inline script, to make CSP happy.
This commit is contained in:
R&D 2015-08-19 15:25:32 -04:00
Родитель ae98626f6d ae49ddca3d
Коммит 42b12bfa97
11 изменённых файлов: 14 добавлений и 62 удалений

Просмотреть файл

@ -57,12 +57,7 @@
</main>
</section>
<script>
var url = 'translations/' + navigator.language + '.js';
// I'm sorry.
document.write('<script src="' + url + '"><' + '/script>');
</script>
<script src="js/load_translations.js"></script>
<script src="js/settings.js"></script>
<script src="js/libs/lodash.custom.min.js"></script>
<script src="js/libs/async_storage.js"></script>

Просмотреть файл

@ -41,11 +41,7 @@
</main>
</section>
<script>
var url = 'translations/' + navigator.language + '.js';
// I'm sorry.
document.write('<script src="' + url + '"><' + '/script>');
</script>
<script src="js/load_translations.js"></script>
<script src="js/settings.js"></script>
<script src="js/libs/async_storage.js"></script>

Просмотреть файл

@ -23,15 +23,6 @@
<!-- localization -->
<link rel="prefetch" type="application/l10n" href="data/locales.ini" />
<link rel="prefetch" type="application/l10n" href="data/date/date.ini" />
<script>
var url = 'translations/' + navigator.language + '.js';
// I'm sorry.
document.write('<script src="' + url + '"><' + '/script>');
</script>
<script src="js/libs/l10n.js" defer></script>
<script src="js/libs/l10n_date.js" defer></script>
</head>
<body class="skin-organic">
<section role="region" class="vbox fit">
@ -72,12 +63,7 @@
</main>
</section>
<script>
var url = 'translations/' + navigator.language + '.js';
// I'm sorry.
document.write('<script src="' + url + '"><' + '/script>');
</script>
<script src="js/load_translations.js"></script>
<script src="js/settings.js"></script>
<script src="js/libs/lodash.custom.min.js"></script>
<script src="js/libs/async_storage.js"></script>

Просмотреть файл

@ -1,4 +1,3 @@
console.log('l10n.js loaded');
'use strict';
(function() {

Просмотреть файл

@ -0,0 +1,5 @@
(function() {
var url = 'translations/' + navigator.language + '.js';
// I'm sorry.
document.write('<script src="' + url + '"><' + '/script>');
})();

Просмотреть файл

@ -58,12 +58,7 @@
</main>
</section>
<script>
var url = 'translations/' + navigator.language + '.js';
// I'm sorry.
document.write('<script src="' + url + '"><' + '/script>');
</script>
<script src="js/load_translations.js"></script>
<script src="js/settings.js"></script>
<script src="js/libs/lodash.custom.min.js"></script>
<script src="js/libs/async_storage.js"></script>

Просмотреть файл

@ -42,11 +42,7 @@
<main id="my-profile" class="fit scroll"></main>
</section>
<script>
var url = 'translations/' + navigator.language + '.js';
// I'm sorry.
document.write('<script src="' + url + '"><' + '/script>');
</script>
<script src="js/load_translations.js"></script>
<script src="js/settings.js"></script>
<script src="js/libs/lodash.custom.min.js"></script>

Просмотреть файл

@ -95,12 +95,7 @@
</menu>
</form>
<script>
var url = 'translations/' + navigator.language + '.js';
// I'm sorry.
document.write('<script src="' + url + '"><' + '/script>');
</script>
<script src="js/load_translations.js"></script>
<script src="js/settings.js"></script>
<script src="js/libs/async_storage.js" defer></script>
<script src="js/libs/nunjucks-slim.js" defer></script>

Просмотреть файл

@ -41,12 +41,7 @@
</main>
</section>
<script>
var url = 'translations/' + navigator.language + '.js';
// I'm sorry.
document.write('<script src="' + url + '"><' + '/script>');
</script>
<script src="js/load_translations.js"></script>
<script src="js/settings.js"></script>
<script src="js/libs/lodash.custom.min.js"></script>
<script src="js/libs/async_storage.js" defer></script>

Просмотреть файл

@ -75,12 +75,7 @@
</main>
</section>
<script>
var url = 'translations/' + navigator.language + '.js';
// I'm sorry.
document.write('<script src="' + url + '"><' + '/script>');
</script>
<script src="js/load_translations.js"></script>
<script src="js/settings.js"></script>
<script src="js/libs/lodash.custom.min.js"></script>
<script src="js/libs/async_storage.js" defer></script>

Просмотреть файл

@ -58,12 +58,7 @@
</main>
</section>
<script>
var url = 'translations/' + navigator.language + '.js';
// I'm sorry.
document.write('<script src="' + url + '"><' + '/script>');
</script>
<script src="js/load_translations.js"></script>
<script src="js/settings.js"></script>
<script src="js/libs/async_storage.js"></script>
<script src="js/libs/lodash.custom.min.js"></script>