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

[sounds] Extract inline script block in net/hurstfrost/hudson/sounds/SoundsAgentPageDecorator/header.jelly

XMLWordPrintable

    • Icon: Task Task
    • Resolution: Unresolved
    • Icon: Minor Minor
    • sounds-plugin

      Problem

      == Inline Script Block
      Line: 4
      ----
      <script type="text/javascript" defer="defer">
        	function _sounds_ajaxJsonFetcherFactory(onSuccess, onFailure) {
      		return function() {
      		    var request = new XMLHttpRequest();
      		    request.responseType = 'json';
      		    request.open("GET", "${request.contextPath}/sounds/getSounds", true);
                  request.onload = function() {
                      if (request.status >= 200 &amp;&amp; request.status &lt; 400) {
                          var responseObject = request.response;
      
                          if (typeof responseObject === 'string') {
                              responseObject = JSON.parse(responseObject);
                          }
                          onSuccess(responseObject);
                      } else {
                          onFailure();
                      }
                  };
                  request.onerror = onFailure;
                  request.send();
        		}
      	}
      
        	if (AUDIO_CAPABLE) {
      	  	_sounds_pollForSounds(_sounds_ajaxJsonFetcherFactory);
      	}
      </script>
      ----
      

      Solution

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

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

              Created:
              Updated: