Skip to content

Commit

Permalink
CSP: change another inline script so that it can be allowed as script…
Browse files Browse the repository at this point in the history
…-src via hash

+ remove some unnecessary spaces
  • Loading branch information
rreich committed Feb 17, 2016
1 parent e8e31dd commit fb93930
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 13 deletions.
Expand Up @@ -143,8 +143,14 @@ CKEDITOR.dialog.add( 'paste', function( editor ) {
var htmlToLoad = '<html dir="' + editor.config.contentsLangDirection + '"' +
' lang="' + ( editor.config.contentsLanguage || editor.langCode ) + '">' +
'<head><style>body{margin:3px;height:95%;word-break:break-all;}</style></head><body>' +
'<script id="cke_actscrpt" type="text/javascript">' +
'window.parent.CKEDITOR.tools.callFunction(' + CKEDITOR.tools.addFunction( onPasteFrameLoad, dialog ) + ',this);' +
'<script id="cke_actscrpt" type="text/javascript" ' +
' data-frameloadedhandler="' + CKEDITOR.tools.addFunction( onPasteFrameLoad, dialog ) + '">' +
' var currentScript = document.currentScript || (function () {' +
' var scripts = document.getElementsByTagName("script");' +
' return scripts[scripts.length - 1];' +
' })();' +
' var frameLoadedHandler = currentScript.getAttribute("data-frameloadedhandler");' +
' window.parent.CKEDITOR.tools.callFunction( frameLoadedHandler, this );' +
'</script></body>' +
'</html>';

Expand Down
Expand Up @@ -433,17 +433,17 @@
'<script id="cke_actscrpt" type="text/javascript"' +
' data-frameloadedhandler="' + this._.frameLoadedHandler +
'"' + ( CKEDITOR.env.ie ? ' defer="defer" ' : '' ) + ' />' +
'var wasLoaded = 0;' +
'function onload() {' +
' if (!wasLoaded) {' +
' var currentScript = document.currentScript || (function () {' +
' var scripts = document.getElementsByTagName("script");' +
' return scripts[scripts.length - 1];' +
' })();' +
' var frameLoadedHandler = currentScript.getAttribute("data-frameloadedhandler");' +
' window.parent.CKEDITOR.tools.callFunction(frameLoadedHandler, window);' +
' }' +
' wasLoaded = 1;' +
' var wasLoaded = 0;' +
' function onload() {' +
' if (!wasLoaded) {' +
' var currentScript = document.currentScript || (function () {' +
' var scripts = document.getElementsByTagName("script");' +
' return scripts[scripts.length - 1];' +
' })();' +
' var frameLoadedHandler = currentScript.getAttribute("data-frameloadedhandler");' +
' window.parent.CKEDITOR.tools.callFunction(frameLoadedHandler, window);' +
' }' +
' wasLoaded = 1;' +
'}' +
( CKEDITOR.env.ie ? 'onload();' : 'document.addEventListener("DOMContentLoaded", onload, false);' ) +
'</script>';
Expand Down

0 comments on commit fb93930

Please sign in to comment.