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

Uncaught TypeError: Cannot read property 'firstChild' of null

      Under some conditions adding a dynamic section to a configuration screen fails with the abovementioned error. In renderOnDemand, c.innerHTML = "<TABLE><TBODY>"+t.responseText+"</TBODY></TABLE>"; succeeds yet immediately afterwards c.firstChild is a HTMLLinkElement rather than the expected HTMLTableElement:

      <link rel="stylesheet" href="/adjuncts/…/lib/form/section_.css" type="text/css">
      

      The second child is indeed the expected table, so something inserted this link element at the top.

      Uri Scheiner says this occurred for him due to <f:advanced> under a separated <f:section>, yet it seems to occur under other circumstances as well.

          [JENKINS-15494] Uncaught TypeError: Cannot read property 'firstChild' of null

          Jesse Glick added a comment -

          Apparently a regression between 1.447 and 1.466.

          Jesse Glick added a comment - Apparently a regression between 1.447 and 1.466.

          Jesse Glick added a comment -

          Seems to be a bug in Chrome; cannot reproduce in Firefox. The stylesheet link was generated by Stapler in the original HTML as part of another table; there is no reason for it to be duplicated when innerHTML is set.

          Bumping up priority since it can break forms with no apparent workaround other than using a different browser. Still have not pinpointed the conditions under which it occurs; a given plugin can have two describables in a pulldown, and selecting the first triggers this bug, while selecting the second does not.

          Jesse Glick added a comment - Seems to be a bug in Chrome; cannot reproduce in Firefox. The stylesheet link was generated by Stapler in the original HTML as part of another table; there is no reason for it to be duplicated when innerHTML is set. Bumping up priority since it can break forms with no apparent workaround other than using a different browser. Still have not pinpointed the conditions under which it occurs; a given plugin can have two describables in a pulldown, and selecting the first triggers this bug, while selecting the second does not.

          Code changed in jenkins
          User: Jesse Glick
          Path:
          changelog.html
          war/src/main/webapp/scripts/hudson-behavior.js
          http://jenkins-ci.org/commit/jenkins/8dbee911c39343c3085a4f56f6e597719ba0c0ca
          Log:
          [FIXED JENKINS-15494] Uncaught TypeError: Cannot read property 'firstChild' of null

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: changelog.html war/src/main/webapp/scripts/hudson-behavior.js http://jenkins-ci.org/commit/jenkins/8dbee911c39343c3085a4f56f6e597719ba0c0ca Log: [FIXED JENKINS-15494] Uncaught TypeError: Cannot read property 'firstChild' of null

          Jesse Glick added a comment -

          Wrapping an <f:section> in <f:nested><table style="width:100%">…</table></f:nested> seems to work around the bug.

          Jesse Glick added a comment - Wrapping an <f:section> in <f:nested><table style="width:100%">…</table></f:nested> seems to work around the bug.

          dogfood added a comment -

          Integrated in jenkins_main_trunk #2000
          [FIXED JENKINS-15494] Uncaught TypeError: Cannot read property 'firstChild' of null (Revision 8dbee911c39343c3085a4f56f6e597719ba0c0ca)

          Result = SUCCESS
          Jesse Glick : 8dbee911c39343c3085a4f56f6e597719ba0c0ca
          Files :

          • changelog.html
          • war/src/main/webapp/scripts/hudson-behavior.js

          dogfood added a comment - Integrated in jenkins_main_trunk #2000 [FIXED JENKINS-15494] Uncaught TypeError: Cannot read property 'firstChild' of null (Revision 8dbee911c39343c3085a4f56f6e597719ba0c0ca) Result = SUCCESS Jesse Glick : 8dbee911c39343c3085a4f56f6e597719ba0c0ca Files : changelog.html war/src/main/webapp/scripts/hudson-behavior.js

          Jesse Glick added a comment -

          Another test case to reproduce: CloudBees Templates plugin, create builder template using hetero components from dtor (one each) of type hudson.tasks.Publisher, try to add this builder to a job. Reproducible from 1.455 (unsurprising since https://github.com/jenkinsci/jenkins/compare/jenkins-1.454...jenkins-1.455 shows extensive JS changes); fixed in 1.487 with this patch.

          Jesse Glick added a comment - Another test case to reproduce: CloudBees Templates plugin, create builder template using hetero components from dtor (one each) of type hudson.tasks.Publisher , try to add this builder to a job. Reproducible from 1.455 (unsurprising since https://github.com/jenkinsci/jenkins/compare/jenkins-1.454...jenkins-1.455 shows extensive JS changes); fixed in 1.487 with this patch.

            Unassigned Unassigned
            jglick Jesse Glick
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: