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

[html-audio-notifier] Extract inline script block and event handlers in WEB-INF/classes/jenkins/plugins/htmlaudio/app/HtmlAudioNotifierPlugin/global.jelly

XMLWordPrintable

      Problems

      == Inline Script Block
      Line: 38
      ----
      <script type="text/javascript">
                testPlayer = new AudioPlayer();
                themePlayer = new AudioPlayer();
                
                testPlayer.player.addEventListener('ended', function() {
                    alert('Completed..');
                }, false);
                
                testPlayer.player.addEventListener('error', function() {
                    alert('Failed.\nMake sure that the URL is correct or try a different file-format..');
                }, false);
                
                function testSound(soundId) {
                    var url = document.getElementById(soundId).value;
                    testPlayer.enqueue(toAbsoluteUrl('${app.rootUrlFromRequest}', url));
                }
                
                function superMarioMode() {
                    setTheme('http://themushroomkingdom.net/sounds/wav/smb/smb_kick.wav',
                      'http://themushroomkingdom.net/sounds/wav/smb/smb_powerup.wav',
                      'http://themushroomkingdom.net/sounds/wav/smb/smb_mariodie.wav')
                    themePlayer.enqueue('http://themushroomkingdom.net/sounds/wav/sm64_memario.wav')
                }
                
                function setTheme(success, successAfterFailure, failure) {
                    document.getElementById('htmlAudioSuccessSoundUrl').value = success
                    document.getElementById('htmlAudioSuccessAfterFailureSoundUrl').value = successAfterFailure
                    document.getElementById('htmlAudioFailureSoundUrl').value = failure
                }
            </script>
      ----
      
      == Inline Event Handler
      Line: 17
      ----
      <input type="button" value="Test" onClick="testSound('htmlAudioSuccessSoundUrl')" />
      ----
      
      == Inline Event Handler
      Line: 23
      ----
      <input type="button" value="Test" onClick="testSound('htmlAudioSuccessAfterFailureSoundUrl')" />
      ----
      
      == Inline Event Handler
      Line: 29
      ----
      <input type="button" value="Test" onClick="testSound('htmlAudioFailureSoundUrl')" />
      ----
      
      == Inline Event Handler
      Line: 33
      ----
      <a href="#" onclick="superMarioMode(); return false;" title="Maaaario">
      ----
      

      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: