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

    • 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

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

          Basil Crow created issue -
          Basil Crow made changes -
          Assignee Original: Clark Whitty [ cwhitty ]
          Basil Crow made changes -
          Description Original: h4. Problems

          {noformat}
          == Inline Event Handler
          Line: 125
          ----
          <body onload="init('tab1');">
          ----

          == 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');">
          ----

          == 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>
          ----
          {noformat}

          h4. Solutions

          [https://www.jenkins.io/doc/developer/security/csp/#inline-javascript-blocks]
          [https://www.jenkins.io/doc/developer/security/csp/#inline-event-handlers]
          New: h4. Problems

          {noformat}
          == 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');">
          ----
          {noformat}

          h4. Solutions

          [https://www.jenkins.io/doc/developer/security/csp/#inline-javascript-blocks]
          [https://www.jenkins.io/doc/developer/security/csp/#inline-event-handlers]
          Summary Original: [itest] Extract inline script blocks and event handlers in com/spirent/plugins/itest/HtmlPublisher/header.html New: [itest] Extract inline script block and event handler in com/spirent/plugins/itest/HtmlPublisher/header.html

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

              Created:
              Updated: