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

            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: