processScript in Wicket.Head.Contributor doesn't remove CDATA - eval fails in IE
--------------------------------------------------------------------------------

                 Key: WICKET-4446
                 URL: https://issues.apache.org/jira/browse/WICKET-4446
             Project: Wicket
          Issue Type: Bug
          Components: wicket
    Affects Versions: 1.5.5, 1.5.4
         Environment: Windows 7 64-bit
Firefox 10 and IE 9
Wicket 1.5.4 and 1.5.5 tested
Jetty
            Reporter: David Rain


There's incosistency between org.apache.wicket.util.string.JavaScriptUtils and 
wicket-ajax.js
Even though the source is marked with comment

         * Script open tag. If this tag is changed, also update 
Wicket.Head.Contributor.processScript()
         * function from wicket-ajax.js

In JavaScriptUtils there are:
public final static String SCRIPT_CONTENT_PREFIX = "\n/*<![CDATA[*/\n";
public final static String SCRIPT_CONTENT_SUFFIX = "\n/*]]>*/\n";

in wicket-ajax.js (line 1742 in 1.5.5 version) there are:
// get rid of prefix and suffix, they are not eval-d correctly
text = text.replace(/^<!--\/\*--><!\[CDATA\[\/\*><!--\*\//, "");
text = text.replace(/\/\*-->]]>\*\/$/, "");

As you can see the sequences in java and javascript DO NOT MATCH! There are 
missing new lines in JS and there are extra HTML comments <!-- --> that aren't 
added by the Java code.
The result is, that these extra lines aren't removed and IE fails to eval such 
a javascript. I could fix this issue by editing the wicket-ajax.js like this:
text = text.replace(/^\n\/\*<!\[CDATA\[\*\/\n/, "");
text = text.replace(/\n\/\*]]>\*\/\n$/, "");

But we need it fixed officially, because we use gradle for Wicket dependency.


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to