ICEfaces
  1. ICEfaces
  2. ICE-6726

With ace:fileEntry in portlet, the table containing the list of uploads is not displayed in IE9, WebKit browsers

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.1
    • Fix Version/s: EE-2.0.0.GA, 2.0.2
    • Component/s: ACE-Components, Bridge
    • Labels:
      None
    • Environment:
      ICEfaces 2 ACE portal portlet IE9 WebKit browsers

      Description

      When using the the ace:fileEntry component in a portlet (in this case Liferay 6.0.6), after the upload is complete, the table that normally shows information about the uploaded file (name, type, size) is not displayed in WebKit browsers (Chrome, Safari) or in IE 9. A reload will refresh the state and display the table. The same example appears to work fine in Firefox 3 and 4.

        Activity

        Hide
        Deryk Sinotte added a comment -

        Further testing shows that the first update may fail on Firefox as well. Subsequent uploads appear to work. This may be related or similar to the issue in http://jira.icefaces.org/browse/ICE-6640.

        Show
        Deryk Sinotte added a comment - Further testing shows that the first update may fail on Firefox as well. Subsequent uploads appear to work. This may be related or similar to the issue in http://jira.icefaces.org/browse/ICE-6640 .
        Hide
        Deryk Sinotte added a comment -

        IE9 works intermittently as well but not sure why. I've been able to successfully get it to show the table on the first and several subsequent uploads. I see a "malformedXml" message in the developer console when it doesn't work but it doesn't always happen.

        Show
        Deryk Sinotte added a comment - IE9 works intermittently as well but not sure why. I've been able to successfully get it to show the table on the first and several subsequent uploads. I see a "malformedXml" message in the developer console when it doesn't work but it doesn't always happen.
        Hide
        Deryk Sinotte added a comment -

        IE 9 actually seemed fine once I cleared the browser cache and used the latest code. However, Safari and Chrome are still having problems. The problem appears to stem from a function in fileEntry.js. In iframeLoaded there's a check to see if the content of the iframe is an instance of XMLDocument or has a value for the xmlEncoding property:

        var d = i.contentDocument;
        if (d instanceof XMLDocument || d.xmlEncoding)

        { var serializer = new XMLSerializer(); var responseText = serializer.serializeToString(d); //i.contentDocument.document.body?i.contentDocument.document.body.innerHTML:null; ice_fileEntry.response(d, responseText, context); }

        For WebKit browsers running in Liferay, both these tests are failing, resulting in the response not being serialzed and passed on to JSF for final processing. After discussing this with the original developer, the check can be changed so that it simply checks if that property is available (not whether it has a non-null value).

        var d = i.contentDocument;
        if (d instanceof XMLDocument || "xmlEncoding" in d)

        { var serializer = new XMLSerializer(); var responseText = serializer.serializeToString(d); //i.contentDocument.document.body?i.contentDocument.document.body.innerHTML:null; ice_fileEntry.response(d, responseText, context); }

        This is the simplest changes that allows Chrome and Safari to work (IE 9 and FF continue to work as well). I did take a stab at refactoring a bit to simply what I thought was being done and removing those checks altogether. I highly recommend adding some logging as well to help pinpoint future failures.

        iframeLoaded : function(context, id) {

        var doc;
        var i = document.getElementById(id);

        if ((typeof XMLDocument != "undefined") && i.contentDocument)

        { doc = i.contentDocument; }

        else if (i.contentWindow && i.contentWindow.document)

        { doc = i.contentWindow.document.XMLDocument ? i.contentWindow.document.XMLDocument : i.contentWindow.document; }

        if(!doc)

        { //Log that we couldn't get the document //error("could not get contents of iframe"); }

        var responseText;
        if (doc.xml)

        { responseText = doc.xml; }

        else

        { var serializer = new XMLSerializer(); responseText = serializer.serializeToString(doc); }

        if(!responseText)

        { //Log that we couldn't get serialize the response text //error("could not serialize response text"); }

        ice_fileEntry.response(doc,responseText,context);
        },

        Show
        Deryk Sinotte added a comment - IE 9 actually seemed fine once I cleared the browser cache and used the latest code. However, Safari and Chrome are still having problems. The problem appears to stem from a function in fileEntry.js. In iframeLoaded there's a check to see if the content of the iframe is an instance of XMLDocument or has a value for the xmlEncoding property: var d = i.contentDocument; if (d instanceof XMLDocument || d.xmlEncoding) { var serializer = new XMLSerializer(); var responseText = serializer.serializeToString(d); //i.contentDocument.document.body?i.contentDocument.document.body.innerHTML:null; ice_fileEntry.response(d, responseText, context); } For WebKit browsers running in Liferay, both these tests are failing, resulting in the response not being serialzed and passed on to JSF for final processing. After discussing this with the original developer, the check can be changed so that it simply checks if that property is available (not whether it has a non-null value). var d = i.contentDocument; if (d instanceof XMLDocument || "xmlEncoding" in d) { var serializer = new XMLSerializer(); var responseText = serializer.serializeToString(d); //i.contentDocument.document.body?i.contentDocument.document.body.innerHTML:null; ice_fileEntry.response(d, responseText, context); } This is the simplest changes that allows Chrome and Safari to work (IE 9 and FF continue to work as well). I did take a stab at refactoring a bit to simply what I thought was being done and removing those checks altogether. I highly recommend adding some logging as well to help pinpoint future failures. iframeLoaded : function(context, id) { var doc; var i = document.getElementById(id); if ((typeof XMLDocument != "undefined") && i.contentDocument) { doc = i.contentDocument; } else if (i.contentWindow && i.contentWindow.document) { doc = i.contentWindow.document.XMLDocument ? i.contentWindow.document.XMLDocument : i.contentWindow.document; } if(!doc) { //Log that we couldn't get the document //error("could not get contents of iframe"); } var responseText; if (doc.xml) { responseText = doc.xml; } else { var serializer = new XMLSerializer(); responseText = serializer.serializeToString(doc); } if(!responseText) { //Log that we couldn't get serialize the response text //error("could not serialize response text"); } ice_fileEntry.response(doc,responseText,context); },
        Hide
        Deryk Sinotte added a comment -

        Assigning to Mark to review the suggestions for fixing this (both the quick fix and the one with more refactoring). Would like to add some official component logging if possible.

        Show
        Deryk Sinotte added a comment - Assigning to Mark to review the suggestions for fixing this (both the quick fix and the one with more refactoring). Would like to add some official component logging if possible.
        Hide
        Mark Collette added a comment -

        I prefer the change that's been committed over the proposed change in the comment above, simply because it's less invasive.

        Show
        Mark Collette added a comment - I prefer the change that's been committed over the proposed change in the comment above, simply because it's less invasive.
        Hide
        Deryk Sinotte added a comment -

        Changes applied to trunk and maintenance branch.

        Show
        Deryk Sinotte added a comment - Changes applied to trunk and maintenance branch.

          People

          • Assignee:
            Mark Collette
            Reporter:
            Deryk Sinotte
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: