-
Task
-
Resolution: Unresolved
-
Minor
Problems
== Inline Script Block
Line: 7
----
<script type="text/javascript">
<![CDATA[
// TODO revisit - adds listeners to prepare syntax highlight editor
// for build step removal (without this, the project won't save).
// This is invoked in two places - CodeMirror#fromTextArea(...) and
// when the editor's onFocus event occurs.
addNodeRemovalListener = function(editor) {
if (typeof editor.removeListenerAdded == 'undefined') {
var buildStepNode = editor.getWrapperElement().
parentNode.parentNode.parentNode.parentNode.parentNode;
buildStepNode.dragging = false;
buildStepNode.addEventListener(
"DOMNodeRemovedFromDocument",
function(event) {
// Switch editor back to non-syntax highlighted mode when the
// build step is removed.
// However don't do this while the build step is being dragged
// (i.e., when it's being re-ordered).
if (!buildStepNode.dragging) {
editor.toTextArea()
}
},
false
)
buildStepNode.addEventListener(
"mousedown",
function(event) {
// Indicates that this build step is being dragged.
buildStepNode.dragging = true
},
false
)
buildStepNode.addEventListener(
"mouseup",
function(event) {
// Indicates that this build step is no longer being dragged.
buildStepNode.dragging = false
},
false
)
editor.removeListenerAdded = true
}
}
// TODO revisit - onChange listener to manually update the source
// <textarea> so that scripts in newly added build steps get saved.
updateTextArea = function(editor) {
editor.getWrapperElement().previousSibling.value=editor.getValue()
}
]]>
</script>
----
== Inline Script Block
Line: 71
----
<script type="text/javascript">
<![CDATA[
// TODO revisit - overrides CodeMirror#fromTextArea(...) to invoke
// addNodeRemovalListener on new editors (applies to existing build
// steps in project - for new build steps, this is applied during the
// editors onFocus())
if (typeof CodeMirror != 'undefined' &&
typeof CodeMirror.hackApplied == 'undefined') {
var origFromTextArea = CodeMirror.fromTextArea
CodeMirror.fromTextArea = function(textArea, options) {
var editor = origFromTextArea(textArea, options)
addNodeRemovalListener(editor)
return editor
}
CodeMirror.hackApplied = true
}
]]>
</script>
----
Solution
https://www.jenkins.io/doc/developer/security/csp/#inline-javascript-blocks