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

Old Prototype library causes problems with modern UI frameworks

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      Jenkins bundles an ancient release of Prototype.js (1.7 in war from 2010, 1.6.0.2 in Stapler from 2008). These releases are not compatible with all features of modern JS frameworks like jQuery and Chart.js and Bootstrap. In order to use other libraries we should upgrade to the latest release 1.7.3 (still old  - 2015 - but with several fixes). 

      E.g., with the bundles 1.7 version the simple 'Hello World' is not shown due to a JS error. With version 1.7.3 the error disappears.

       

        Attachments

          Issue Links

            Activity

            Show
            oleg_nenashev Oleg Nenashev added a comment - https://github.com/jenkinsci/jenkins/pull/3277
            Hide
            drulli Ulli Hafner added a comment -

            See also the stack trace if Chart.js is used within Jenkins with Prototype.JS 1.7.

            Show
            drulli Ulli Hafner added a comment - See also the stack trace if Chart.js is used within Jenkins with Prototype.JS 1.7.
            Hide
            drulli Ulli Hafner added a comment -

            Here is an example of the upcoming release of analysis-core: Priority Doughnut Graph. If I change the graph type to a bar-chart then the error in the stack trace (comment before) appears.

            Show
            drulli Ulli Hafner added a comment - Here is an example of the upcoming release of analysis-core: Priority Doughnut Graph . If I change the graph type to a bar-chart then the error in the stack trace (comment before) appears.
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Ulli Hafner
            Path:
            war/src/main/webapp/scripts/prototype.js
            http://jenkins-ci.org/commit/jenkins/5ed43002d7daca06676c565aab18c1842123281f
            Log:
            [FIXED JENKINS-49319] Upgrade to Prototype 1.7.3.

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Ulli Hafner Path: war/src/main/webapp/scripts/prototype.js http://jenkins-ci.org/commit/jenkins/5ed43002d7daca06676c565aab18c1842123281f Log: [FIXED JENKINS-49319] Upgrade to Prototype 1.7.3.
            Hide
            oleg_nenashev Oleg Nenashev added a comment -

            The fix has been integrated towards 2.110. I am not marking it as LTS candidate, because it seems to be a bit risky to backport it. Ulli Hafner please mark it as LTS candidate if you need it in the release

            Show
            oleg_nenashev Oleg Nenashev added a comment - The fix has been integrated towards 2.110. I am not marking it as LTS candidate, because it seems to be a bit risky to backport it. Ulli Hafner please mark it as LTS candidate if you need it in the release
            Hide
            drulli Ulli Hafner added a comment -

            Hmm, seems to be easier to switch a UI library in my plugins rather then replace this library in core Jenkins.

            Show
            drulli Ulli Hafner added a comment - Hmm, seems to be easier to switch a UI library in my plugins rather then replace this library in core Jenkins.
            Hide
            djviking Sverre Moe added a comment -

            This issue caught my eye, when I was trying to solve the Jenkins slow loading problem reported in JENKINS-56243. After upgrading to Jenkins 2.181 loading was fast again, but for some multibranch projects loading a branch seemd to load completely, but hang in there for 30+ seconds and it seems prototype.js was the culprit that did not quite finish.

            Show
            djviking Sverre Moe added a comment - This issue caught my eye, when I was trying to solve the Jenkins slow loading problem reported in JENKINS-56243 . After upgrading to Jenkins 2.181 loading was fast again, but for some multibranch projects loading a branch seemd to load completely, but hang in there for 30+ seconds and it seems prototype.js was the culprit that did not quite finish.
            Hide
            christian Christian Kipping added a comment -

            Hello,
            we need this fix also in the LTS version of Jenkins. What do I have to do, to get this fix?

            Is it possible to use other plugins to workaround this problem?

            Show
            christian Christian Kipping added a comment - Hello, we need this fix also in the LTS version of Jenkins. What do I have to do, to get this fix? Is it possible to use other plugins to workaround this problem?
            Hide
            drulli Ulli Hafner added a comment -

            There is no fix yet, so no chance to get it into the LTS release. The fix above (https://github.com/jenkinsci/jenkins/pull/3277) has been reverted since several old plugins rely on the old and broken prototype functionality. Since we have no UI tests for them (and no responsible UI architect in core) I doubt that we ever get rid of this library.

            Show
            drulli Ulli Hafner added a comment - There is no fix yet, so no chance to get it into the LTS release. The fix above ( https://github.com/jenkinsci/jenkins/pull/3277 ) has been reverted since several old plugins rely on the old and broken prototype functionality. Since we have no UI tests for them (and no responsible UI architect in core) I doubt that we ever get rid of this library.
            Hide
            danielbeck Daniel Beck added a comment -

            Ulli Hafner If you see "obat", that's Indonesian spam/a spammer. It's OK if they just create issues, but the vandalism elsewhere disrupts more

            Show
            danielbeck Daniel Beck added a comment - Ulli Hafner If you see "obat", that's Indonesian spam/a spammer. It's OK if they just create issues, but the vandalism elsewhere disrupts more
            Hide
            sephirothj Ronny Perinke added a comment -

            It is possible to restore the original / native implementation of an overridden prototype function. It would also be possible to restore whole prototype. Here is an example for a single function. I'm sure you know how to restore whole prototype based on this.

            function getNativeFunction(clazz, func) {
                const frame = document.createElement('iframe');
                frame.style.display = 'none';
                document.body.appendChild(frame);
                const nativeClazz = frame.contentWindow[clazz];
                frame.parentNode.removeChild(frame);
                return nativeClazz.prototype[func];
            }
            
            if (Array.prototype.filter.toString().indexOf('[native code]') === -1) {
                Array.prototype.filter = getNativeFunction('Array', 'filter');
            }
            
            Show
            sephirothj Ronny Perinke added a comment - It is possible to restore the original / native implementation of an overridden prototype function. It would also be possible to restore whole prototype. Here is an example for a single function. I'm sure you know how to restore whole prototype based on this. function getNativeFunction(clazz, func) { const frame = document.createElement( 'iframe' ); frame.style.display = 'none' ; document.body.appendChild(frame); const nativeClazz = frame.contentWindow[clazz]; frame.parentNode.removeChild(frame); return nativeClazz.prototype[func]; } if (Array.prototype.filter.toString().indexOf( '[ native code]' ) === -1) { Array.prototype.filter = getNativeFunction( 'Array' , 'filter' ); }
            Hide
            drulli Ulli Hafner added a comment -

            I think that we will never get a sufficient test coverage before making this change. Since I found workarounds for my JS libraries I think we can close this issue.

            Show
            drulli Ulli Hafner added a comment - I think that we will never get a sufficient test coverage before making this change. Since I found workarounds for my JS libraries I think we can close this issue.

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              drulli Ulli Hafner
              Votes:
              1 Vote for this issue
              Watchers:
              7 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: