Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-74105

[dynamic_extended_choice_parameter] Extract inline script block and event handler in com/moded/extendedchoiceparameter/ExtendedChoiceParameterDefinition/index.jelly

XMLWordPrintable

      Problems

      == Inline Script Block
      Line: 25
      ----
      <script>
      		function get_data_${it.name}(str) {
      		src_name=str;
      		bindfieldname="${it.bindFieldName}";
      		var foo = <st:bind value="${it}"/>
      		var file_path="${it.propertyFile}"
      		
      		if (file_path.indexOf("/") != -1)
      		{
      			var home_path=file_path.substring( 0, file_path.lastIndexOf( "/" ) ) + "/";
      		}
      		else
      		{
      			var home_path=file_path.substring( 0, file_path.lastIndexOf( "\\" ) ) + "\\";
      		}
      		var file_tmp_path=home_path + str + ".txt";
      		var file_name=file_tmp_path;
      		var file_key="${it.propertyKey}";
      		response_data=""
      		document.getElementById("spinnerImg_${it.name}").style.display = "";
      		element=get_parent(bindfieldname);
      		
      		var parent_element=element.parentNode;
      		parent_element.childNodes[ parent_element.childNodes.length - 1 ].disabled = true;
      		
      		foo.computeValue(file_name,file_key,src_name, function(t) {
      			response_data = t.responseObject();
      			parent_element.removeChild(parent_element.childNodes[ parent_element.childNodes.length - 1 ]);
      			parent_element.innerHTML = parent_element.innerHTML + response_data;
      			document.getElementById("spinnerImg_${it.name}").style.display = "none";
      					
      		});
      		}
      </script>
      ----
      
      == Inline Event Handler
      Line: 15
      ----
      <select name="value" id="${it.name}" onChange="get_data_${it.name}(this.value)">
      ----
      

      Solutions

      https://www.jenkins.io/doc/developer/security/csp/#inline-javascript-blocks
      https://www.jenkins.io/doc/developer/security/csp/#inline-event-handlers

            Unassigned Unassigned
            basil Basil Crow
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: