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

[project-inheritance] Extract inline script block and event handlers in form/redirectTask.jelly

XMLWordPrintable

      Problems

      == Inline Script Block
      Line: 160
      ----
      <script>
                        function postRequest_${id}(a) {
                            new Ajax.Request(
                                a.href,
                                {
                                    onSuccess: function(rsp) {
                                        // Check if the original and final URL disagree
                                        var orig = rsp.request.url;
                                        var redir = rsp.transport.responseURL;
                                        if (orig &amp;&amp; orig != redir) {
                                            //A redirect happened. Actually sending the user to that page
                                            window.location.href = rsp.transport.responseURL;
                                        } else {
                                            //No redirect, display hovering "Done"
                                            hoverNotification('${%Done.}', a.parentNode);
                                        }
                                    },
                                    onFailure: function(rsp) {
                                        //Display error in a hover text
                                        hoverNotification('Error: ' + rsp.statusText, a.parentNode);
                                    }
                                }
                            );
                            //Do not permit any further processing
                            return false;
                        }
                    </script>
      ----
      
      == Inline Event Handler
      Line: 203
      ----
      <a href="${href}" class="task-icon-link" onclick="${attrs.onclick ?: (post ? 'return postRequest_' + id + '(this)' : null)}">
      ----
      
      == Inline Event Handler
      Line: 231
      ----
      <a href="${href}" class="task-link" onclick="${attrs.onclick ?: (post ? 'return postRequest_' + id + '(this)' : null)}">
      ----
      

      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: