ICEmobile
  1. ICEmobile
  2. MOBI-1145

Uncaught TypeError: Cannot read property 'firstChild' of undefined

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Invalid
    • Affects Version/s: EE 1.3.0.GA_P01
    • Fix Version/s: None
    • Component/s: Faces
    • Labels:
      None
    • Environment:
      ICEmobile 1.3.0 USS

      Description

      When changing an ace:comboBox and calling its ValueChangeListener, the following JavaScript error is thrown which is preventing the update from being displayed:

      jsf.js.jsf:1 Uncaught TypeError: Cannot read property 'firstChild' of undefined

      This happens when there are mobi components on the page.

        Activity

        Hide
        Arran Mccullough added a comment -

        This is the error reported in Firefox: TypeError: xml.getElementsByTagName(...)[0] is undefined

        Show
        Arran Mccullough added a comment - This is the error reported in Firefox: TypeError: xml.getElementsByTagName(...) [0] is undefined
        Hide
        Arran Mccullough added a comment -

        Attached test case that shows this issue. Note: Due to size restrictions I have removed the icefaces-ee.jar, icefaces-ee-ace.jar, and icefaces-ee-ext.jar files.

        Steps:

        • Load welcomeICEmobile.jsf
        • In the first comboBox make a selection. In the browser console a script error is thrown.
        • The update should update the contents of the second comboBox but it remains empty.
        Show
        Arran Mccullough added a comment - Attached test case that shows this issue. Note: Due to size restrictions I have removed the icefaces-ee.jar, icefaces-ee-ace.jar, and icefaces-ee-ext.jar files. Steps: Load welcomeICEmobile.jsf In the first comboBox make a selection. In the browser console a script error is thrown. The update should update the contents of the second comboBox but it remains empty.
        Hide
        Philip Breau added a comment -

        If the <ace:fileEntry> component is removed the problem goes away. So there's some incompatibility between the ace:fileEntry and the ICEmobile, probably related to multipart processing. ICEmobile 1.3 relies on multipart processing. The <multipart/> configuration must be added to the Faces Servlet. After adding this to the example, the error still occurred though.

        It doesn't seem related to the USS custom ICEmobile build, as I can reproduce on the stock IM 1.3.0 and 1.3.1 with the mobile showcase sample. And it's only the ace:fileEntry that causes the problem.

        What's happening is that for some reason the XHR response is coming back as a full page response, not as a true JSF XML-formatted partial response. But it is still being handled as an out-of-bounds XHR response by the ICEmobile script, which is expecting to parse a JSF partial response and not finding the expected content.

        Simply checking for null here won't solve the problem as the root problem is that response is coming back as a full page response and not as a partial response.

        Perhaps the FileEntry mechanism of adding '?ice.fileentry.multipart=true' to the form action attribute is messing up the way ICEmobile sets and fires the intercepted Ajax requests. I'll continue to test that.

        Show
        Philip Breau added a comment - If the <ace:fileEntry> component is removed the problem goes away. So there's some incompatibility between the ace:fileEntry and the ICEmobile, probably related to multipart processing. ICEmobile 1.3 relies on multipart processing. The <multipart/> configuration must be added to the Faces Servlet. After adding this to the example, the error still occurred though. It doesn't seem related to the USS custom ICEmobile build, as I can reproduce on the stock IM 1.3.0 and 1.3.1 with the mobile showcase sample. And it's only the ace:fileEntry that causes the problem. What's happening is that for some reason the XHR response is coming back as a full page response, not as a true JSF XML-formatted partial response. But it is still being handled as an out-of-bounds XHR response by the ICEmobile script, which is expecting to parse a JSF partial response and not finding the expected content. Simply checking for null here won't solve the problem as the root problem is that response is coming back as a full page response and not as a partial response. Perhaps the FileEntry mechanism of adding '?ice.fileentry.multipart=true' to the form action attribute is messing up the way ICEmobile sets and fires the intercepted Ajax requests. I'll continue to test that.
        Hide
        Philip Breau added a comment -

        According the FileEntry documentation (http://www.icesoft.org/wiki/display/ICE/FileEntry) the fileEntry component has to be in a form where components do not use XHR and Ajax:

        The fileEntry component requires that a non-AJAX full form submit occur to upload the file contents. This is an HTML 4 requirement. It then intercepts this submit and employs it's own AJAX techniques to allow for a partial page update, instead of the typical full page update. It does not use XmlHttpRequest at any point. Because of this, no component may upload the files by doing an AJAX submit, but rather must do a standard full form submit.

        As the mobi components rely on Ajax, and cannot fully function solely through full-page updates, they may be inherently incompatible with the fileEntry component.

        Show
        Philip Breau added a comment - According the FileEntry documentation ( http://www.icesoft.org/wiki/display/ICE/FileEntry ) the fileEntry component has to be in a form where components do not use XHR and Ajax: The fileEntry component requires that a non-AJAX full form submit occur to upload the file contents. This is an HTML 4 requirement. It then intercepts this submit and employs it's own AJAX techniques to allow for a partial page update, instead of the typical full page update. It does not use XmlHttpRequest at any point. Because of this, no component may upload the files by doing an AJAX submit, but rather must do a standard full form submit. As the mobi components rely on Ajax, and cannot fully function solely through full-page updates, they may be inherently incompatible with the fileEntry component.

          People

          • Assignee:
            Philip Breau
            Reporter:
            Arran Mccullough
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: