MyFaces Tomahawk
  1. MyFaces Tomahawk
  2. TOMAHAWK-69

t:inputCalendar + javscript(using variable tabList) = page hang.

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Calendar
    • Labels:
      None
    • Environment:
      jboss-4.0.2
      jdk1.5.0_04
      Firefox 1.0.7
      myfaces-20051107.zip
      Struts 1.2.7

      Description

      I started with the bug of t:calendar and onload not working in release 1.1.1
      I then moved on to the nightly release 20051107.

      New bug...

      If I have a page with <t:inputCalendar and

      <script language="JavaScript1.3">
      function messWithMyHead() {
      for (var i=0; i<tabList.length; i++ ) {
      }
      }
      </script>

      The page will never be displayed.

      1: I don't call the JavaScript, it just has to exist on the page.
      2: Method name is not the cause
      3: Remming out the for loop does not stop the problem
      4: REMOVING the for loop does allow the page to be displayed.
      5: REMOVING the <t:inputCalendar allows the page to be displayed.
      6: No error message is displayed in the JBoss console, it just hangs.

      To prove this, download my ear (link at bottom) & go to the address...

      http://localhost:8080/ebusiness/
      (Change port if required)

      The page will not be displayed.

      Then go into the ear, then the war and open the file theTest.jsp

      Removed the for loop lines (or the t:calendar), save & exit.

      Go back to the address & the page will display.

      Example ear of the problem at...
      http://www.porter.eu.com/jeff/prob.ear (3meg - inc libs)

      Hope someone else can verify this for me.

      Jeff.

        Activity

        Hide
        jeff porter added a comment -

        example ear of the problem.

        Show
        jeff porter added a comment - example ear of the problem.
        Hide
        Martin Marinschek added a comment -

        Hmmm.

        Can you try to change the name of the javascript function from anything with "head" in it to something else?

        Even though I am sure that Simon's new parser implementation could not be fooled by this.

        regards,

        Martin

        Show
        Martin Marinschek added a comment - Hmmm. Can you try to change the name of the javascript function from anything with "head" in it to something else? Even though I am sure that Simon's new parser implementation could not be fooled by this. regards, Martin
        Hide
        jeff porter added a comment -

        Hi Martin,

        Yep I've already tried that. I've just re-tried it with the java script method sig...

        function qwerty() {
        // remove these two line (not rem) and all will work.
        // ELSE - remove the t:inputCalendar and the page will be displayed
        for (var i=0; i<tabList.length; i++ ) {
        }
        }

        The result is the same.

        Jeff

        Show
        jeff porter added a comment - Hi Martin, Yep I've already tried that. I've just re-tried it with the java script method sig... function qwerty() { // remove these two line (not rem) and all will work. // ELSE - remove the t:inputCalendar and the page will be displayed for (var i=0; i<tabList.length; i++ ) { } } The result is the same. Jeff
        Hide
        Martin Marinschek added a comment -

        So it is the

        <

        in the for var(i=0; i<

        that is disturbing the new parser implementation.

        Simon, any idea?

        regards,

        Martin

        Show
        Martin Marinschek added a comment - So it is the < in the for var(i=0; i< that is disturbing the new parser implementation. Simon, any idea? regards, Martin
        Hide
        Simon Kitching added a comment -

        Ok, I've tracked down the official spec for how <script> is handled:
        http://www.w3.org/TR/REC-html40/appendix/notes.html#notes-specifying-data

        The script and style tags need to be handled in a special manner, where the parser looks for the first occurrence of "</".
        I'll provide a patch to implement this.

        In the meantime, I believe you can work around this by using the standard script-hiding approach for browsers that don't handle scripting, because the ReducedHTMLParser is currently acting exactly like an old browser that doesn't recognise the special behaviour of <script>.

        <script ...>
        <!--
        function messWithMyHead() {
        for (var i=0; i<tabList.length; i++ ) {
        }
        }
        // -->
        </script>

        I'll also try to figure out why an infinite loop occurs; even inserting the AddResource text at the wrong location would be better than that.

        Thanks for the report.

        See also:
        http://issues.apache.org/jira/browse/MYFACES-768

        Show
        Simon Kitching added a comment - Ok, I've tracked down the official spec for how <script> is handled: http://www.w3.org/TR/REC-html40/appendix/notes.html#notes-specifying-data The script and style tags need to be handled in a special manner, where the parser looks for the first occurrence of "</". I'll provide a patch to implement this. In the meantime, I believe you can work around this by using the standard script-hiding approach for browsers that don't handle scripting, because the ReducedHTMLParser is currently acting exactly like an old browser that doesn't recognise the special behaviour of <script>. <script ...> <!-- function messWithMyHead() { for (var i=0; i<tabList.length; i++ ) { } } // --> </script> I'll also try to figure out why an infinite loop occurs; even inserting the AddResource text at the wrong location would be better than that. Thanks for the report. See also: http://issues.apache.org/jira/browse/MYFACES-768
        Hide
        Martin Marinschek added a comment -

        Can you check again with a nightly build from today/tomorrow?

        I have just committed a fix from Simon Kitching for this problem.

        regards,

        Martin

        Show
        Martin Marinschek added a comment - Can you check again with a nightly build from today/tomorrow? I have just committed a fix from Simon Kitching for this problem. regards, Martin
        Hide
        jeff porter added a comment -

        Hi Martin,

        I've downloaded te build.. myfaces-20051105.zip

        Its fine with the code...

        // <

        but the code....

        // i<tabList.length;

        Still causes it to disappear into an endless loos & not display the page.

        Jeff

        Show
        jeff porter added a comment - Hi Martin, I've downloaded te build.. myfaces-20051105.zip Its fine with the code... // < but the code.... // i<tabList.length; Still causes it to disappear into an endless loos & not display the page. Jeff

          People

          • Assignee:
            Unassigned
            Reporter:
            jeff porter
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:

              Development