You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Jörn Zaefferer (JIRA)" <ji...@apache.org> on 2008/08/28 11:21:44 UTC

[jira] Created: (WICKET-1806) JavascriptStripper ignores context when looking for multiline comments

JavascriptStripper ignores context when looking for multiline comments
----------------------------------------------------------------------

                 Key: WICKET-1806
                 URL: https://issues.apache.org/jira/browse/WICKET-1806
             Project: Wicket
          Issue Type: Bug
          Components: wicket
    Affects Versions: 1.3.4
            Reporter: Jörn Zaefferer
             Fix For: 1.3.5


org.apache.wicket.util.string.JavascriptStripper#stripCommentsAndWhitespace doesn't check the context when looking for multiline comments. In my case, it interprets the default accept header in the jQuery source code as a multiline comment:

accepts: {
	xml: "application/xml, text/xml",
	html: "text/html",
	script: "text/javascript, application/javascript",
	json: "application/json, text/javascript",
	text: "text/plain",
	_default: "*/*"
}

The culprit being this string: "*/*"

I don't have a patch and I wouldn't try to write my own JS parser. Maybe replacing the current implementation with a Rhino-based one is an option. Its available via Maven:

<dependency>
    <groupId>rhino</groupId>
    <artifactId>js</artifactId>
    <version>1.7R1</version>
</dependency>

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WICKET-1806) JavascriptStripper ignores context when looking for multiline comments

Posted by "Jörn Zaefferer (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-1806?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12627301#action_12627301 ] 

Jörn Zaefferer commented on WICKET-1806:
----------------------------------------

Here is the file: http://code.google.com/p/jqueryjs/downloads/detail?name=jquery-1.2.6.js

> JavascriptStripper ignores context when looking for multiline comments
> ----------------------------------------------------------------------
>
>                 Key: WICKET-1806
>                 URL: https://issues.apache.org/jira/browse/WICKET-1806
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.3.4
>            Reporter: Jörn Zaefferer
>            Assignee: Matej Knopp
>             Fix For: 1.3.5
>
>
> org.apache.wicket.util.string.JavascriptStripper#stripCommentsAndWhitespace doesn't check the context when looking for multiline comments. In my case, it interprets the default accept header in the jQuery source code as a multiline comment:
> accepts: {
> 	xml: "application/xml, text/xml",
> 	html: "text/html",
> 	script: "text/javascript, application/javascript",
> 	json: "application/json, text/javascript",
> 	text: "text/plain",
> 	_default: "*/*"
> }
> The culprit being this string: "*/*"
> I don't have a patch and I wouldn't try to write my own JS parser. Maybe replacing the current implementation with a Rhino-based one is an option. Its available via Maven:
> <dependency>
>     <groupId>rhino</groupId>
>     <artifactId>js</artifactId>
>     <version>1.7R1</version>
> </dependency>

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WICKET-1806) JavascriptStripper ignores context when looking for multiline comments

Posted by "Matej Knopp (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-1806?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12627295#action_12627295 ] 

Matej Knopp commented on WICKET-1806:
-------------------------------------

I added the testcase you've provided to Javascript stripper test and it strips it just fine. No problem at all. Can you attach the whole javascript that fails to get stripped successfully? 

> JavascriptStripper ignores context when looking for multiline comments
> ----------------------------------------------------------------------
>
>                 Key: WICKET-1806
>                 URL: https://issues.apache.org/jira/browse/WICKET-1806
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.3.4
>            Reporter: Jörn Zaefferer
>            Assignee: Matej Knopp
>             Fix For: 1.3.5
>
>
> org.apache.wicket.util.string.JavascriptStripper#stripCommentsAndWhitespace doesn't check the context when looking for multiline comments. In my case, it interprets the default accept header in the jQuery source code as a multiline comment:
> accepts: {
> 	xml: "application/xml, text/xml",
> 	html: "text/html",
> 	script: "text/javascript, application/javascript",
> 	json: "application/json, text/javascript",
> 	text: "text/plain",
> 	_default: "*/*"
> }
> The culprit being this string: "*/*"
> I don't have a patch and I wouldn't try to write my own JS parser. Maybe replacing the current implementation with a Rhino-based one is an option. Its available via Maven:
> <dependency>
>     <groupId>rhino</groupId>
>     <artifactId>js</artifactId>
>     <version>1.7R1</version>
> </dependency>

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WICKET-1806) JavascriptStripper ignores context when looking for multiline comments

Posted by "Jörn Zaefferer (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-1806?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12627300#action_12627300 ] 

Jörn Zaefferer commented on WICKET-1806:
----------------------------------------

I tested it with jQuery 1.2.6, which contains the offending line. The stripping didn't fail (no exception), but the resulting code got messed up.

> JavascriptStripper ignores context when looking for multiline comments
> ----------------------------------------------------------------------
>
>                 Key: WICKET-1806
>                 URL: https://issues.apache.org/jira/browse/WICKET-1806
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.3.4
>            Reporter: Jörn Zaefferer
>            Assignee: Matej Knopp
>             Fix For: 1.3.5
>
>
> org.apache.wicket.util.string.JavascriptStripper#stripCommentsAndWhitespace doesn't check the context when looking for multiline comments. In my case, it interprets the default accept header in the jQuery source code as a multiline comment:
> accepts: {
> 	xml: "application/xml, text/xml",
> 	html: "text/html",
> 	script: "text/javascript, application/javascript",
> 	json: "application/json, text/javascript",
> 	text: "text/plain",
> 	_default: "*/*"
> }
> The culprit being this string: "*/*"
> I don't have a patch and I wouldn't try to write my own JS parser. Maybe replacing the current implementation with a Rhino-based one is an option. Its available via Maven:
> <dependency>
>     <groupId>rhino</groupId>
>     <artifactId>js</artifactId>
>     <version>1.7R1</version>
> </dependency>

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (WICKET-1806) JavascriptStripper ignores context when looking for multiline comments

Posted by "Igor Vaynberg (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-1806?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Igor Vaynberg reassigned WICKET-1806:
-------------------------------------

    Assignee: Matej Knopp

> JavascriptStripper ignores context when looking for multiline comments
> ----------------------------------------------------------------------
>
>                 Key: WICKET-1806
>                 URL: https://issues.apache.org/jira/browse/WICKET-1806
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.3.4
>            Reporter: Jörn Zaefferer
>            Assignee: Matej Knopp
>             Fix For: 1.3.5
>
>
> org.apache.wicket.util.string.JavascriptStripper#stripCommentsAndWhitespace doesn't check the context when looking for multiline comments. In my case, it interprets the default accept header in the jQuery source code as a multiline comment:
> accepts: {
> 	xml: "application/xml, text/xml",
> 	html: "text/html",
> 	script: "text/javascript, application/javascript",
> 	json: "application/json, text/javascript",
> 	text: "text/plain",
> 	_default: "*/*"
> }
> The culprit being this string: "*/*"
> I don't have a patch and I wouldn't try to write my own JS parser. Maybe replacing the current implementation with a Rhino-based one is an option. Its available via Maven:
> <dependency>
>     <groupId>rhino</groupId>
>     <artifactId>js</artifactId>
>     <version>1.7R1</version>
> </dependency>

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (WICKET-1806) JavascriptStripper ignores context when looking for multiline comments

Posted by "Matej Knopp (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-1806?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Matej Knopp resolved WICKET-1806.
---------------------------------

    Resolution: Fixed

Fixed, committed for 1.3 branch and trunk. 

> JavascriptStripper ignores context when looking for multiline comments
> ----------------------------------------------------------------------
>
>                 Key: WICKET-1806
>                 URL: https://issues.apache.org/jira/browse/WICKET-1806
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.3.4
>            Reporter: Jörn Zaefferer
>            Assignee: Matej Knopp
>             Fix For: 1.3.5
>
>
> org.apache.wicket.util.string.JavascriptStripper#stripCommentsAndWhitespace doesn't check the context when looking for multiline comments. In my case, it interprets the default accept header in the jQuery source code as a multiline comment:
> accepts: {
> 	xml: "application/xml, text/xml",
> 	html: "text/html",
> 	script: "text/javascript, application/javascript",
> 	json: "application/json, text/javascript",
> 	text: "text/plain",
> 	_default: "*/*"
> }
> The culprit being this string: "*/*"
> I don't have a patch and I wouldn't try to write my own JS parser. Maybe replacing the current implementation with a Rhino-based one is an option. Its available via Maven:
> <dependency>
>     <groupId>rhino</groupId>
>     <artifactId>js</artifactId>
>     <version>1.7R1</version>
> </dependency>

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.