• Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • core
    • 1.424

      The contents of the bind expression, and any further contents of your <script>, are dumped outside of any script block and appear as plain text in the web page.

      Adding <st:adjunct includes="org.kohsuke.stapler.bind"/> first solves that problem, but now your <script> block is not run at all.

          [JENKINS-15617] <st:bind> does not work inside <l:ajax>

          Jesse Glick added a comment -

          <st:adjunct assumes="org.kohsuke.stapler.framework.prototype.prototype" includes="org.kohsuke.stapler.bind"/> is actually necessary as the workaround for the first part; otherwise you sometimes get errors in the page like Cannot call method 'select' of undefined since Prototype exists but has no member Selector.

          Jesse Glick added a comment - <st:adjunct assumes="org.kohsuke.stapler.framework.prototype.prototype" includes="org.kohsuke.stapler.bind"/> is actually necessary as the workaround for the first part; otherwise you sometimes get errors in the page like Cannot call method 'select' of undefined since Prototype exists but has no member Selector .

          Jesse Glick added a comment -

          Simpler still: <st:adjunct assumes="org.kohsuke.stapler.bind"/>

          Jesse Glick added a comment - Simpler still: <st:adjunct assumes="org.kohsuke.stapler.bind"/>

          Code changed in jenkins
          User: Kohsuke Kawaguchi
          Path:
          war/src/main/webapp/scripts/hudson-behavior.js
          http://jenkins-ci.org/commit/jenkins/5aca73f1831f7895220e7c869cfb13e6c2db131a
          Log:
          JENKINS-15617

          This needs to be eval, not geval.
          Plus I forgot to return the value.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Kohsuke Kawaguchi Path: war/src/main/webapp/scripts/hudson-behavior.js http://jenkins-ci.org/commit/jenkins/5aca73f1831f7895220e7c869cfb13e6c2db131a Log: JENKINS-15617 This needs to be eval, not geval. Plus I forgot to return the value.

          dogfood added a comment -

          Integrated in jenkins_main_trunk #2029
          [FIXED JENKINS-15617] (Revision 51f508ba371ee222dced304c4a77a9b1b4ca37db)

          Result = UNSTABLE
          kohsuke : 51f508ba371ee222dced304c4a77a9b1b4ca37db
          Files :

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

          dogfood added a comment - Integrated in jenkins_main_trunk #2029 [FIXED JENKINS-15617] (Revision 51f508ba371ee222dced304c4a77a9b1b4ca37db) Result = UNSTABLE kohsuke : 51f508ba371ee222dced304c4a77a9b1b4ca37db Files : war/src/main/webapp/scripts/hudson-behavior.js

          dogfood added a comment -

          Integrated in jenkins_main_trunk #2030
          JENKINS-15617 (Revision 5aca73f1831f7895220e7c869cfb13e6c2db131a)

          Result = UNSTABLE
          kohsuke : 5aca73f1831f7895220e7c869cfb13e6c2db131a
          Files :

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

          dogfood added a comment - Integrated in jenkins_main_trunk #2030 JENKINS-15617 (Revision 5aca73f1831f7895220e7c869cfb13e6c2db131a) Result = UNSTABLE kohsuke : 5aca73f1831f7895220e7c869cfb13e6c2db131a Files : war/src/main/webapp/scripts/hudson-behavior.js

          Jesse Glick added a comment -

          51f508b breaks config page loading in IE 8 on XP.

          Jesse Glick added a comment - 51f508b breaks config page loading in IE 8 on XP.

          Jesse Glick added a comment -
          diff --git a/war/src/main/webapp/scripts/hudson-behavior.js b/war/src/main/webapp/scripts/hudson-behavior.js
          index c88fc9f..4eb41b7 100644
          --- a/war/src/main/webapp/scripts/hudson-behavior.js
          +++ b/war/src/main/webapp/scripts/hudson-behavior.js
          @@ -500,7 +500,7 @@ function isInsideRemovable(e) {
            */
           function renderOnDemand(e,callback,noBehaviour) {
               if (!e || !Element.hasClassName(e,"render-on-demand")) return;
          -    var proxy = geval(e.getAttribute("proxy"));
          +    var proxy = eval(e.getAttribute("proxy"));
               proxy.render(function (t) {
                   var contextTagName = e.parentNode.tagName;
                   var c;
          

          seems to fix it. Why is geval being used so widely?

          Jesse Glick added a comment - diff --git a/war/src/main/webapp/scripts/hudson-behavior.js b/war/src/main/webapp/scripts/hudson-behavior.js index c88fc9f..4eb41b7 100644 --- a/war/src/main/webapp/scripts/hudson-behavior.js +++ b/war/src/main/webapp/scripts/hudson-behavior.js @@ -500,7 +500,7 @@ function isInsideRemovable(e) { */ function renderOnDemand(e,callback,noBehaviour) { if (!e || !Element.hasClassName(e, "render-on-demand" )) return ; - var proxy = geval(e.getAttribute( "proxy" )); + var proxy = eval(e.getAttribute( "proxy" )); proxy.render(function (t) { var contextTagName = e.parentNode.tagName; var c; seems to fix it. Why is geval being used so widely?

          The idea behind geval is not to let evaluated script to access local in-scope variables as well as letting them put stuff into global scope, so I think it's sound to prefer geval as much as possible.

          Now, it turns out execScript always return null which means it can't be used at all where we need the return value.

          The next step is, who said eval on IE is broken? On my IE8 in the standards mode, "window.eval" seems to work as expected. MSDN backs me up and claims it has been there since IE6.

          Kohsuke Kawaguchi added a comment - The idea behind geval is not to let evaluated script to access local in-scope variables as well as letting them put stuff into global scope, so I think it's sound to prefer geval as much as possible. Now, it turns out execScript always return null which means it can't be used at all where we need the return value. The next step is, who said eval on IE is broken? On my IE8 in the standards mode, "window.eval" seems to work as expected. MSDN backs me up and claims it has been there since IE6.

          Code changed in jenkins
          User: Kohsuke Kawaguchi
          Path:
          war/src/main/webapp/scripts/hudson-behavior.js
          http://jenkins-ci.org/commit/jenkins/1c578ab5542bd20904c4a5e4ebcc80b42af31bbb
          Log:
          [FIXED JENKINS-15617]

          execScript cannot return value [1], so I'm restricting its use to where
          we don't care about the return value. See ticket for more discussions

          [1] http://msdn.microsoft.com/en-us/library/ie/ms536420(v=vs.85).aspx

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Kohsuke Kawaguchi Path: war/src/main/webapp/scripts/hudson-behavior.js http://jenkins-ci.org/commit/jenkins/1c578ab5542bd20904c4a5e4ebcc80b42af31bbb Log: [FIXED JENKINS-15617] execScript cannot return value [1] , so I'm restricting its use to where we don't care about the return value. See ticket for more discussions [1] http://msdn.microsoft.com/en-us/library/ie/ms536420(v=vs.85).aspx

          dogfood added a comment -

          Integrated in jenkins_main_trunk #2037
          [FIXED JENKINS-15617] (Revision 1c578ab5542bd20904c4a5e4ebcc80b42af31bbb)

          Result = UNSTABLE
          kohsuke : 1c578ab5542bd20904c4a5e4ebcc80b42af31bbb
          Files :

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

          dogfood added a comment - Integrated in jenkins_main_trunk #2037 [FIXED JENKINS-15617] (Revision 1c578ab5542bd20904c4a5e4ebcc80b42af31bbb) Result = UNSTABLE kohsuke : 1c578ab5542bd20904c4a5e4ebcc80b42af31bbb Files : war/src/main/webapp/scripts/hudson-behavior.js

            kohsuke Kohsuke Kawaguchi
            jglick Jesse Glick
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: