Bug 1017257 - Make loop code CSP-friendly (remove all inline script) r=Standard8

This commit is contained in:
Adam Roach [:abr] 2014-09-15 15:39:12 -07:00
parent 1c5f67f8c4
commit 772c1c9de0
9 changed files with 25 additions and 10 deletions

View File

@ -11,21 +11,14 @@
<link rel="stylesheet" type="text/css" href="loop/shared/css/common.css">
<link rel="stylesheet" type="text/css" href="loop/shared/css/conversation.css">
</head>
<body class="fx-embedded" onload="loop.conversation.init();">
<body class="fx-embedded">
<div id="messages"></div>
<div id="main"></div>
<script type="text/javascript" src="loop/libs/l10n.js"></script>
<script>
window.OTProperties = {
cdnURL: 'loop/',
};
window.OTProperties.assetURL = window.OTProperties.cdnURL + 'sdk-content/';
window.OTProperties.configURL = window.OTProperties.assetURL + 'js/dynamic_config.min.js';
window.OTProperties.cssURL = window.OTProperties.assetURL + 'css/ot.css';
</script>
<script type="text/javascript" src="loop/js/otconfig.js"></script>
<script type="text/javascript" src="loop/libs/sdk.js"></script>
<script type="text/javascript" src="loop/shared/libs/react-0.11.1.js"></script>
<script type="text/javascript" src="loop/shared/libs/jquery-2.1.0.js"></script>

View File

@ -431,3 +431,5 @@ loop.conversation = (function(OT, mozL10n) {
init: init
};
})(window.OT, document.mozL10n);
document.addEventListener('DOMContentLoaded', loop.conversation.init);

View File

@ -431,3 +431,5 @@ loop.conversation = (function(OT, mozL10n) {
init: init
};
})(window.OT, document.mozL10n);
document.addEventListener('DOMContentLoaded', loop.conversation.init);

View File

@ -0,0 +1,10 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
window.OTProperties = {
cdnURL: 'loop/',
};
window.OTProperties.assetURL = window.OTProperties.cdnURL + 'sdk-content/';
window.OTProperties.configURL = window.OTProperties.assetURL + 'js/dynamic_config.min.js';
window.OTProperties.cssURL = window.OTProperties.assetURL + 'css/ot.css';

View File

@ -551,3 +551,5 @@ loop.panel = (function(_, mozL10n) {
ToSView: ToSView
};
})(_, document.mozL10n);
document.addEventListener('DOMContentLoaded', loop.panel.init);

View File

@ -551,3 +551,5 @@ loop.panel = (function(_, mozL10n) {
ToSView: ToSView
};
})(_, document.mozL10n);
document.addEventListener('DOMContentLoaded', loop.panel.init);

View File

@ -10,7 +10,7 @@
<link rel="stylesheet" type="text/css" href="loop/shared/css/common.css">
<link rel="stylesheet" type="text/css" href="loop/shared/css/panel.css">
</head>
<body class="panel" onload="loop.panel.init();">
<body class="panel">
<div id="main"></div>

View File

@ -14,6 +14,7 @@ browser.jar:
content/browser/loop/js/client.js (content/js/client.js)
content/browser/loop/js/desktopRouter.js (content/js/desktopRouter.js)
content/browser/loop/js/conversation.js (content/js/conversation.js)
content/browser/loop/js/otconfig.js (content/js/otconfig.js)
content/browser/loop/js/panel.js (content/js/panel.js)
# Shared styles

View File

@ -49,6 +49,9 @@
<script src="conversation_test.js"></script>
<script src="panel_test.js"></script>
<script>
// Stop the default init functions running to avoid conflicts in tests
document.removeEventListener('DOMContentLoaded', loop.panel.init);
document.removeEventListener('DOMContentLoaded', loop.conversation.init);
mocha.run(function () {
$("#mocha").append("<p id='complete'>Complete.</p>");
});