8 Replies Latest reply on Jul 24, 2014 5:26 AM by Scott Carpenter

    Chrome update breaks <rich:fileUpload> 3.3.3.Final

    John Peters Newbie

      Hi,

       

      The latest Chrome update is breaking the rich file uploader. Here's the component on the showcase:

       

      http://livedemo.exadel.com/richfaces-demo/richfaces/fileUpload.jsf

       

      How do I submit a bug report?

       

      Best.

        • 1. Re: Chrome update breaks <rich:fileUpload> 3.3.3.Final
          Brian Leathem Master

          RichFaces 3 is no longer supported.  Migrate your application to RichFaces 4 for support with modern browsers.

          • 2. Re: Chrome update breaks <rich:fileUpload> 3.3.3.Final
            Mark Donovan Newbie

            Consider...

             

            Object.extend(FileUpload.prototype, {

                        add: function (A) {

                            if (this.disabled) {

                                return

                            }

                            if (!A.value) {

                                return

                            }

                            if (!this.checkFileType(A.value) || !this.checkDuplicated(A)) {

                                var F = A.value;

                                var B = A.cloneNode(true);

                                B.value = "";

                                A.parentNode.replaceChild(B, A);

                                this.currentInput = B;

                                if (this.events.ontyperejected) {

                                    this.element.fire("rich:ontyperejected", {

                                        fileName: F

                                    })

                                }

                                return

                            }

                            var D = new FileUploadEntry(A, this);

                            this.entries.push(D);

                            if (this.runUpload) {

                                D.setState(FileUploadEntry.READY)

                            } else {

                                D.setState(FileUploadEntry.INITIALIZED)

                            }

             

             

                            // When the object was being cloned, it's onchange value was being fired as well.

                            // was

                            // var B = A.cloneNode(true);

                            // A.onchange = null;

             

             

                            // begin

             

             

                            var onchangeAttribute = $j(A).attr('onchange');

                            $j(A).attr('onchange', '');

                            var B = A.cloneNode(false);

                            $j(B).attr(onchange, onchangeAttribute);

             

             

                            // done

             

             

                            A.style.cssText = "position: absolute; right: 0px; top: 0px; display: none; visibility: hidden;";

                            B.id = this.id + ":file" + (this.idCounter++);

                            B.value = "";

                            this.currentInput = B;

                            A.parentNode.appendChild(B);

                            if (this.events.onadd) {

                                var C = [];

                                C.push(D);

                                this.element.fire("rich:onadd", {

                                    entries: C

                                })

                            }

                            if (this.runUpload) {

                                this.upload()

                            }

                        }

                    });

            • 3. Re: Chrome update breaks <rich:fileUpload> 3.3.3.Final
              andrey panasenko Newbie

              Try to add attribute noDuplicate="true". It works for me.

              • 4. Re: Chrome update breaks <rich:fileUpload> 3.3.3.Final
                Scott Carpenter Newbie

                This worked great for me. Thanks!

                 

                Code as used in 3.3.4:

                 

                var onchangeAttribute = $(elt).attr('onchange');

                $(elt).attr('onchange', '');

                var newUpload = elt.cloneNode(false);

                $(newUpload).attr('onchange', onchangeAttribute);

                • 5. Re: Chrome update breaks <rich:fileUpload> 3.3.3.Final
                  Mark Donovan Newbie

                  I just tried noDuplicate="true". Works just as well.

                  I'll probably go with this route as it's less invasive.

                   

                  Thanks Andrey

                  • 8. Re: Chrome update breaks <rich:fileUpload> 3.3.3.Final
                    Scott Carpenter Newbie

                    Ha! I saw your comment about noDuplicate after I had already gotten a new UI jar compiled with the JS fix, and my first thought was that it was only a variation on the JS change (and I don't think I've really found noDuplicate documented, still), so I just stuck with that until I ran into another problem related to this. But ultimately it is noDuplicate that fixes (or at least works around) this for me, and yes, it is a much better path than mucking about with local changes to richfaces-ui jar!

                     

                    I just wanted to say thank you, Andrey, and others in this thread -- this is very helpful for bridging the time to a Chrome fix.

                     

                    Now, back to that 3.x to 4.x migration I happened to be working on already. :-)