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

[itest] Extract inline script block and event handler in com/spirent/plugins/itest/HtmlPublisher/header.html

XMLWordPrintable

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

      Problems

      == Inline Script Block
      Line: 77
      ----
      <script type="text/javascript">
      function updateBody(tabId, page) {
          document.getElementById(selectedTab).setAttribute("class", "unselected");
          tab = document.getElementById(tabId)
          tab.setAttribute("class", "selected");
          selectedTab = tabId;
          iframe = document.getElementById("myframe");
          iframe.src = tab.getAttribute("value");
      }
      function init(tabId){
      	updateBody(tabId);
      	updateViewport();
      	
      	window.onresize = updateViewport;
      }
      
      function updateViewport(){
      	 var viewportheight;
      
      	 // the more standards compliant browsers (mozilla/netscape/opera/IE7) use window.innerWidth and window.innerHeight
      
      	 if (typeof window.innerWidth != 'undefined')
      	 {
      	      viewportheight = window.innerHeight
      	 }
      
      	// IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document)
      
      	 else if (typeof document.documentElement != 'undefined'
      	     && typeof document.documentElement.clientWidth !=
      	     'undefined' && document.documentElement.clientWidth != 0)
      	 {
      	       viewportheight = document.documentElement.clientHeight
      	 }
      	// older versions of IE
      	 else
      	 { 
      	       viewportheight = document.getElementsByTagName('body')[0].clientHeight
      	 }
      	
      	iframe = document.getElementById("myframe");
      	iframe.style.height = (viewportheight-30)+'px';
      }
      var selectedTab = "tab1"
      </script>
      ----
      
      == Inline Event Handler
      Line: 125
      ----
      <body onload="init('tab1');">
      ----
      

      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: