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

Filter on labelled checkbox choices throws a Javascript exception

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • active-choices-plugin
    • None
    • Jenkins 2.277.4
      uno-choice 2.5.6

    Description

      A Javascript error is thrown (in browser console) when filtering an Active Choice Parameter with labelled checkbox choices.

      The error :

      unochoice.js:802 Uncaught TypeError: Cannot read properties of undefined (reading 'tagName')
          at HTMLInputElement.<anonymous> (unochoice.js:802)
          at HTMLInputElement.dispatch (jquery.full.js:5226)
          at HTMLInputElement.elemData.handle (jquery.full.js:4878)
      

      The config.xml :

      <?xml version='1.1' encoding='UTF-8'?>
      <flow-definition plugin="workflow-job@2.40">
        <properties>
          <hudson.model.ParametersDefinitionProperty>
            <parameterDefinitions>
              <org.biouno.unochoice.ChoiceParameter plugin="uno-choice@2.5.6">
                <name>foo</name>
                <description></description>
                <randomName>choice-parameter-15212631359824743</randomName>
                <visibleItemCount>1</visibleItemCount>
                <script class="org.biouno.unochoice.model.GroovyScript">
                  <secureScript plugin="script-security@1.77">
                    <script>[&apos;foo&apos;: &apos;This is foo&apos;, &apos;bar&apos;: &apos;This is bar&apos;, &apos;baz&apos;: &apos;This is baz&apos;]
      </script>
                    <sandbox>true</sandbox>
                  </secureScript>
                  <secureFallbackScript plugin="script-security@1.77">
                    <script>[&apos;fallback&apos;]</script>
                    <sandbox>true</sandbox>
                  </secureFallbackScript>
                </script>
                <projectName>test-eci-activechoice</projectName>
                <projectFullName>test-eci-activechoice</projectFullName>
                <choiceType>PT_CHECKBOX</choiceType>
                <filterable>true</filterable>
                <filterLength>1</filterLength>
              </org.biouno.unochoice.ChoiceParameter>
            </parameterDefinitions>
          </hudson.model.ParametersDefinitionProperty>
        </properties>
        <definition class="org.jenkinsci.plugins.workflow.cps.CpsFlowDefinition" plugin="workflow-cps@2.92">
          <script>pipeline {
          agent any
      
          stages {
              stage(&apos;Hello&apos;) {
                  steps {
                      echo &apos;Hello World&apos;
                  }
              }
          }
      }
      </script>
          <sandbox>true</sandbox>
        </definition>
        <disabled>false</disabled>
      </flow-definition>
      

      Attachments

        Issue Links

          Activity

            ericcitaire Eric Citaire added a comment - See https://github.com/jenkinsci/active-choices-plugin/pull/52  for a fix.

            Hmm, couldn't reproduce it on `master`. Either fixed, I didn't manage to reproduce it, or something else is causing the JS error.

            My `config.xml`.

             <?xml version='1.1' encoding='UTF-8'?>
            <project>
              <actions/>
              <description></description>
              <keepDependencies>false</keepDependencies>
              <properties>
                <hudson.model.ParametersDefinitionProperty>
                  <parameterDefinitions>
                    <org.biouno.unochoice.ChoiceParameter plugin="uno-choice@2.5.7-SNAPSHOT">
                      <name>a</name>
                      <description></description>
                      <randomName>choice-parameter-35114778400275</randomName>
                      <visibleItemCount>1</visibleItemCount>
                      <script class="org.biouno.unochoice.model.GroovyScript">
                        <secureScript plugin="script-security@1.77">
                          <script>[&apos;foo&apos;: &apos;This is foo&apos;, &apos;bar&apos;: &apos;This is bar&apos;, &apos;baz&apos;: &apos;This is baz&apos;]</script>
                          <sandbox>true</sandbox>
                        </secureScript>
                        <secureFallbackScript plugin="script-security@1.77">
                          <script>return [&apos;fallback&apos;]</script>
                          <sandbox>true</sandbox>
                        </secureFallbackScript>
                      </script>
                      <projectName>JENKINS-66703</projectName>
                      <projectFullName>JENKINS-66703</projectFullName>
                      <choiceType>PT_CHECKBOX</choiceType>
                      <filterable>true</filterable>
                      <filterLength>1</filterLength>
                    </org.biouno.unochoice.ChoiceParameter>
                  </parameterDefinitions>
                </hudson.model.ParametersDefinitionProperty>
              </properties>
              <scm class="hudson.scm.NullSCM"/>
              <canRoam>true</canRoam>
              <disabled>false</disabled>
              <blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
              <blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
              <triggers/>
              <concurrentBuild>false</concurrentBuild>
              <builders/>
              <publishers/>
              <buildWrappers/>
            </project>
            kinow Bruno P. Kinoshita added a comment - Hmm, couldn't reproduce it on `master`. Either fixed, I didn't manage to reproduce it, or something else is causing the JS error. My `config.xml`. <?xml version='1.1' encoding='UTF-8'?> <project> <actions/> <description></description> <keepDependencies>false</keepDependencies> <properties> <hudson.model.ParametersDefinitionProperty> <parameterDefinitions> <org.biouno.unochoice.ChoiceParameter plugin="uno-choice@2.5.7-SNAPSHOT"> <name>a</name> <description></description> <randomName>choice-parameter-35114778400275</randomName> <visibleItemCount>1</visibleItemCount> <script class="org.biouno.unochoice.model.GroovyScript"> <secureScript plugin="script-security@1.77"> <script>[&apos;foo&apos;: &apos;This is foo&apos;, &apos;bar&apos;: &apos;This is bar&apos;, &apos;baz&apos;: &apos;This is baz&apos;]</script> <sandbox>true</sandbox> </secureScript> <secureFallbackScript plugin="script-security@1.77"> <script>return [&apos;fallback&apos;]</script> <sandbox>true</sandbox> </secureFallbackScript> </script> <projectName>JENKINS-66703</projectName> <projectFullName>JENKINS-66703</projectFullName> <choiceType>PT_CHECKBOX</choiceType> <filterable>true</filterable> <filterLength>1</filterLength> </org.biouno.unochoice.ChoiceParameter> </parameterDefinitions> </hudson.model.ParametersDefinitionProperty> </properties> <scm class="hudson.scm.NullSCM"/> <canRoam>true</canRoam> <disabled>false</disabled> <blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding> <blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding> <triggers/> <concurrentBuild>false</concurrentBuild> <builders/> <publishers/> <buildWrappers/> </project>
            ericcitaire Eric Citaire added a comment -

            I managed to reproduce it on master, with `mvn hpi:run`, with no additional plugin.

            To get the error in Dev Tools console, you need to type text in the filter input, on the "Build with Parameters" page. The entries are not filtered and an the error is thrown in the console.

            ericcitaire Eric Citaire added a comment - I managed to reproduce it on master, with `mvn hpi:run`, with no additional plugin. To get the error in Dev Tools console, you need to type text in the filter input, on the "Build with Parameters" page. The entries are not filtered and an the error is thrown in the console.

            Hi ericcitaire

            Thanks for testing master. There might be something else in your environment that is different than mine, and that is causing the issue.

            Just made sure that I had the latest code from master, copied your `config.xml` from this issue description, and replaced my `config.xml`. Reloaded Jenkins.

            Successfully filtered the parameter on Firefox and Chromium and Chrome on Ubuntu LTS. See GIFrecord... gif image for a screenshot of the plug-in with your `config.xml`. I have NoScript and uBlock origin enabled in every browser, which normally causes some issues. But these extensions didn't seem to impact the functionality of the plug-in.

            Could you check if there isn't another setting that we have different in our environment, ericcitaire ? I have Jenkins 2.263.1 with

            Apache Maven 3.8.2 (ea98e05a04480131370aa0c110b8c54cf726c06f)
            Maven home: /opt/apache-maven-3.8.2
            Java version: 11.0.11, vendor: Ubuntu, runtime: /usr/lib/jvm/java-11-openjdk-amd64
            Default locale: en_US, platform encoding: UTF-8
            OS name: "linux", version: "5.4.0-89-generic", arch: "amd64", family: "unix" 

            It's Ubuntu 20.04 LTS, and Firefox 93.0 (build 64).

            Cheers

            Bruno

            kinow Bruno P. Kinoshita added a comment - Hi ericcitaire Thanks for testing master. There might be something else in your environment that is different than mine, and that is causing the issue. Just made sure that I had the latest code from master, copied your `config.xml` from this issue description, and replaced my `config.xml`. Reloaded Jenkins. Successfully filtered the parameter on Firefox and Chromium and Chrome on Ubuntu LTS. See GIFrecord... gif image for a screenshot of the plug-in with your `config.xml`. I have NoScript and uBlock origin enabled in every browser, which normally causes some issues. But these extensions didn't seem to impact the functionality of the plug-in. Could you check if there isn't another setting that we have different in our environment, ericcitaire ? I have Jenkins 2.263.1 with Apache Maven 3.8.2 (ea98e05a04480131370aa0c110b8c54cf726c06f) Maven home: /opt/apache-maven-3.8.2 Java version: 11.0.11, vendor: Ubuntu, runtime: /usr/lib/jvm/java-11-openjdk-amd64 Default locale: en_US, platform encoding: UTF-8 OS name: "linux", version: "5.4.0-89-generic", arch: "amd64", family: "unix" It's Ubuntu 20.04 LTS, and Firefox 93.0 (build 64). Cheers Bruno
            ericcitaire Eric Citaire added a comment -

            My bad, my setup is slightly different from master : I had a newer Jenkins version (2.277.4), changed in pom.xml line 39.

            I tried every Jenkins version from 2.263 to 2.277. The bug was introduced in 2.264, apparently with some changes in forms layout (see Changelog).

            ericcitaire Eric Citaire added a comment - My bad, my setup is slightly different from master : I had a newer Jenkins version (2.277.4), changed in pom.xml line 39. I tried every Jenkins version from 2.263 to 2.277. The bug was introduced in 2.264, apparently with some changes in forms layout (see Changelog ).

            Fixed but unreleased

            ioannis Ioannis Moutsatsos added a comment - Fixed but unreleased

            Was fixed by 2bc8115, closing. Released in Active Choices release 2.6.4

            ioannis Ioannis Moutsatsos added a comment - Was fixed by  2bc8115 , closing. Released in Active Choices release 2.6.4

            Was fixed by 2bc8115, closing

            ioannis Ioannis Moutsatsos added a comment - Was fixed by  2bc8115 , closing

            People

              ioannis Ioannis Moutsatsos
              ericcitaire Eric Citaire
              Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: