ICEfaces-EE
  1. ICEfaces-EE
  2. IPCK-472

InputFile: JS error occuring in File Upload Demo

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: EE-1.8.2.GA_P05
    • Fix Version/s: EE-1.8.2.GA_P08
    • Component/s: Facelet Components
    • Labels:
      None
    • Environment:
      ICEfaces EE 1.8.2.GA_P07 Build7
      IE9/10
    • Assignee Priority:
      P1

      Description

      Process Components > File Upload Progress
      JS error occurs when navigating to this demo and then navigating away from it. Only reproducible in IE9/10:
      Message: Unable to set property 'InputFileIdPostUpload' of undefined or null reference
      Line: 1
      Char: 76
      Code: 0
      URI: http://ec2-54-212-81-211.us-west-2.compute.amazonaws.com:7001/icefaces-enterprise-comps-showcase/uploadHtml

        Activity

        Cruz Miraback created issue -
        Cruz Miraback made changes -
        Field Original Value New Value
        Affects Version/s EE-1.8.2.GA_P05 [ 10331 ]
        Affects Version/s EE-1.8.2.GA_P07 [ 10672 ]
        Ken Fyten made changes -
        Project ICEfaces [ 10021 ] ICEfaces-EE [ 10040 ]
        Key ICE-9466 IPCK-472
        Affects Version/s EE-1.8.2.GA_P05 [ 10330 ]
        Affects Version/s EE-1.8.2.GA_P05 [ 10331 ]
        Component/s Facelet Components [ 10031 ]
        Component/s Sample Apps [ 10010 ]
        Ken Fyten made changes -
        Assignee Philip Breau [ philip.breau ]
        Fix Version/s EE-1.8.2.GA_P08 [ 11177 ]
        Cruz Miraback made changes -
        Environment ICEfaces EE 1.8.2.GA_P07 Build7 ICEfaces EE 1.8.2.GA_P07 Build7
        IE9/10
        Philip Breau made changes -
        Summary enterprise-comps-showcase > JS error occuring in File Upload Progress Demo InputFile: JS error occuring in File Upload Demo
        Hide
        Philip Breau added a comment -

        js error under same conditions is also occurring in the ICEfaces 1.8 Showcase:

        <script type="text/javascript">
        var submit = function() { 
           if(arguments.length == 1 && arguments[0] == 1) { 
              parent.Ice.InputFileIdPostUpload = 'iceform:icepnltabset:0:myInputFile_inputFile'; 
              parent.Ice.InputFileIdPreUpload = null; 
           } 
           else { return; } 
           try { 
              if(parent.document.getElementById('iceform')) { 
                 parent.document.getElementById('iceform').submit(); 
              } 
           } catch (e) { parent.logger.warn('Form not available', e); } 
           finally { 
              parent.Ice.InputFileIdPreUpload = null; 
              parent.Ice.InputFileIdPostUpload = null; 
           } 
        };
        document.getElementsByTagName('form')[0].onsubmit = submit;
        var uploadEnd = function() { submit(1);};
        if (window.attachEvent) { 
           window.attachEvent('onunload', uploadEnd); 
        } else { 
           window.onunload = uploadEnd; 
        }
        </script>
        

        'parent.Ice' on the first reference of InputFileIdPostUpload is undefined. Looks like the script from the file upload iframe is running on a navigation and the reference to parent.Ice has already been unloaded.

        Show
        Philip Breau added a comment - js error under same conditions is also occurring in the ICEfaces 1.8 Showcase: <script type= "text/javascript" > var submit = function() { if (arguments.length == 1 && arguments[0] == 1) { parent.Ice.InputFileIdPostUpload = 'iceform:icepnltabset:0:myInputFile_inputFile'; parent.Ice.InputFileIdPreUpload = null ; } else { return ; } try { if (parent.document.getElementById('iceform')) { parent.document.getElementById('iceform').submit(); } } catch (e) { parent.logger.warn('Form not available', e); } finally { parent.Ice.InputFileIdPreUpload = null ; parent.Ice.InputFileIdPostUpload = null ; } }; document.getElementsByTagName('form')[0].onsubmit = submit; var uploadEnd = function() { submit(1);}; if (window.attachEvent) { window.attachEvent('onunload', uploadEnd); } else { window.onunload = uploadEnd; } </script> 'parent.Ice' on the first reference of InputFileIdPostUpload is undefined. Looks like the script from the file upload iframe is running on a navigation and the reference to parent.Ice has already been unloaded.
        Ken Fyten made changes -
        Assignee Philip Breau [ philip.breau ] Mark Collette [ mark.collette ]
        Assignee Priority P1 [ 10010 ]
        Hide
        Mark Collette added a comment - - edited

        What are the DOM updates coming back to the browser for the:

        • Pre-upload
        • File upload
        • Post-upload
        Show
        Mark Collette added a comment - - edited What are the DOM updates coming back to the browser for the: Pre-upload File upload Post-upload
        Hide
        Mark Collette added a comment -

        And where does that script come from, that Philip posted?

        Show
        Mark Collette added a comment - And where does that script come from, that Philip posted?
        Hide
        Philip Breau added a comment - - edited

        It's rendered by the Input File component. InputFile.java

        Show
        Philip Breau added a comment - - edited It's rendered by the Input File component. InputFile.java
        Hide
        Mark Collette added a comment -

        It makes sense now, the ice:inputFile has postUpload set to true and preUpload set to false, and this is the script that gets rendered. So all I need is the DOM updates that come back in the upload, to see if that's nuking the iframe, and thus ruining the postUpload environment.

        Show
        Mark Collette added a comment - It makes sense now, the ice:inputFile has postUpload set to true and preUpload set to false, and this is the script that gets rendered. So all I need is the DOM updates that come back in the upload, to see if that's nuking the iframe, and thus ruining the postUpload environment.
        Hide
        Mark Collette added a comment -

        I'm investigating using onbeforeunload instead of onunload, or using a setTimeout in the postUpload handling, in case the parent is temporarily unavailable.

        Seems related:
        http://social.msdn.microsoft.com/Forums/ie/en-US/00b88378-a7f1-4148-9587-1ff17d6fa728/windows-7-problem-with-submit-in-onbeforeunload-event-in-ie

        Show
        Mark Collette added a comment - I'm investigating using onbeforeunload instead of onunload, or using a setTimeout in the postUpload handling, in case the parent is temporarily unavailable. Seems related: http://social.msdn.microsoft.com/Forums/ie/en-US/00b88378-a7f1-4148-9587-1ff17d6fa728/windows-7-problem-with-submit-in-onbeforeunload-event-in-ie
        Ken Fyten made changes -
        Assignee Mark Collette [ mark.collette ] Mircea Toma [ mircea.toma ]
        Fix Version/s EE-1.8.2.GA_P07 [ 10673 ]
        Fix Version/s EE-1.8.2.GA_P08 [ 11177 ]
        Ken Fyten made changes -
        Fix Version/s EE-1.8.2.GA_P08 [ 11177 ]
        Fix Version/s EE-1.8.2.GA_P07 [ 10673 ]
        Hide
        Mircea Toma added a comment -

        The fix applied modifies the iframes included in the element that is about to be updated to force the browser into honouring the 'beforeunload' and 'unload' events. Modified InputFile iframe to use 'beforeunload' event so that the elements it works with are still available.

        Show
        Mircea Toma added a comment - The fix applied modifies the iframes included in the element that is about to be updated to force the browser into honouring the 'beforeunload' and 'unload' events. Modified InputFile iframe to use 'beforeunload' event so that the elements it works with are still available.
        Mircea Toma made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #37232 Thu Jul 25 16:43:50 MDT 2013 mircea.toma IPCK-472 Modify the iframes included in the element that is about to be updated to force the browser into honoring the 'beforeunload' and 'unload' events. Modified InputFile iframe to use 'beforeunload' event so that it the elements it works with are still available.
        Files Changed
        Commit graph MODIFY /icefaces/trunk/icefaces/bridge/lib/element.js
        Commit graph MODIFY /icefaces/trunk/icefaces/component/src/com/icesoft/faces/component/inputfile/InputFile.java
        Commit graph MODIFY /icefaces/trunk/icefaces/bridge/src/application.js
        Ken Fyten made changes -
        Status Resolved [ 5 ] Closed [ 6 ]

          People

          • Assignee:
            Mircea Toma
            Reporter:
            Cruz Miraback
          • Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: