Syntax error after parsing JavaScript directives in comments

RESOLVED DUPLICATE of bug 397868

Status

P5
major
RESOLVED DUPLICATE of bug 397868
11 years ago
11 years ago

People

(Reporter: fenik17, Unassigned)

Tracking

head
x86
Windows XP

Details

(Reporter)

Description

11 years ago
User-Agent:       Opera/9.25 (Windows NT 5.1; U; ru)
Build Identifier: 1.6R7

Script JSCookMenu.js ( http://jscook.sourceforge.net/JSCookMenu/ ) exist code:

---------------------
// disable iframe masking for IE7
/*@cc_on
	@if (@_jscript_version >= 5.6)
		if (_cmFrameMasking)
		{
			var v = navigator.appVersion;
			var i = v.indexOf ("MSIE ");
			if (i >= 0)
			{
				if (parseInt (navigator.appVersion.substring (i + 5)) >= 7)
					_cmFrameMasking = false;
			}
		}
	@end
@*/

var _cmClicked = false;				// for onClick
---------------------

After parsing line open comment tag with directive (/*@cc_on) is deleted, but closing tag (@*/) wasn't deleted and at next line (var _cmClicked = false;) JavaScriptEngine generate exception "syntax error":


Exception class=[org.mozilla.javascript.EvaluatorException]
com.gargoylesoftware.htmlunit.ScriptException: syntax error (http://localhost:8090/app?digest=b190e8e8797dfda62ef63c45592706e8&service=asset&path=%2FJSCookMenu-mod.js#144)
	at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:557)
	at org.mozilla.javascript.Context.call(Context.java:577)
	at org.mozilla.javascript.Context.call(Context.java:499)
	at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.compile(JavaScriptEngine.java:396)
	at com.gargoylesoftware.htmlunit.html.HtmlPage.loadJavaScriptFromUrl(HtmlPage.java:887)
	at com.gargoylesoftware.htmlunit.html.HtmlPage.loadExternalJavaScriptFile(HtmlPage.java:792)
	at com.gargoylesoftware.htmlunit.html.HtmlScript.executeScriptIfNeeded(HtmlScript.java:276)
	at com.gargoylesoftware.htmlunit.html.HtmlScript.onAddedToPage(HtmlScript.java:197)
	at com.gargoylesoftware.htmlunit.html.HtmlPage.notifyNodeAdded(HtmlPage.java:1497)
	at com.gargoylesoftware.htmlunit.html.DomNode.appendDomChild(DomNode.java:808)
	at com.gargoylesoftware.htmlunit.html.HTMLParser$HtmlUnitDOMBuilder.startElement(HTMLParser.java:392)
	at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)
	at org.cyberneko.html.filters.DefaultFilter.startElement(DefaultFilter.java:179)
	at org.cyberneko.html.filters.NamespaceBinder.startElement(NamespaceBinder.java:286)
	at org.cyberneko.html.HTMLTagBalancer.callStartElement(HTMLTagBalancer.java:1009)
	at org.cyberneko.html.HTMLTagBalancer.startElement(HTMLTagBalancer.java:639)
	at org.cyberneko.html.HTMLScanner$ContentScanner.scanStartElement(HTMLScanner.java:2407)
	at org.cyberneko.html.HTMLScanner$ContentScanner.scan(HTMLScanner.java:1881)
	at org.cyberneko.html.HTMLScanner.scanDocument(HTMLScanner.java:809)
	at org.cyberneko.html.HTMLConfiguration.parse(HTMLConfiguration.java:478)
	at org.cyberneko.html.HTMLConfiguration.parse(HTMLConfiguration.java:431)
	at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
	at com.gargoylesoftware.htmlunit.html.HTMLParser.parse(HTMLParser.java:253)
	at com.gargoylesoftware.htmlunit.DefaultPageCreator.createHtmlPage(DefaultPageCreator.java:116)
	at com.gargoylesoftware.htmlunit.DefaultPageCreator.createPage(DefaultPageCreator.java:89)
	at com.gargoylesoftware.htmlunit.WebClient.loadWebResponseInto(WebClient.java:450)
	at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:359)
	at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:407)
	at net.sourceforge.jwebunit.htmlunit.HtmlUnitDialog.gotoPage(HtmlUnitDialog.java:197)
	at net.sourceforge.jwebunit.junit.WebTester.gotoPage(WebTester.java:2118)
	at org.owllabs.unitest.MyTest.myVoid(MyTest.java:41)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.junit.internal.runners.TestMethodRunner.executeMethodBody(TestMethodRunner.java:99)
	at org.junit.internal.runners.TestMethodRunner.runUnprotected(TestMethodRunner.java:81)
	at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34)
	at org.junit.internal.runners.TestMethodRunner.runMethod(TestMethodRunner.java:75)
	at org.junit.internal.runners.TestMethodRunner.run(TestMethodRunner.java:45)
	at org.junit.internal.runners.TestClassMethodsRunner.invokeTestMethod(TestClassMethodsRunner.java:66)
	at org.junit.internal.runners.TestClassMethodsRunner.run(TestClassMethodsRunner.java:35)
	at org.junit.internal.runners.TestClassRunner$1.runUnprotected(TestClassRunner.java:42)
	at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34)
	at org.junit.internal.runners.TestClassRunner.run(TestClassRunner.java:52)
	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38)
	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)


---
Sorry for my english.

Reproducible: Always

Steps to Reproduce:
1. Add <script type="text/javascript" src="JSCookMenu.js"></script> to html page head.
2. Processing this page by Rhino 1.6R7. For example, used HtmlUnit.
Actual Results:  
exeption "syntax error"
(Reporter)

Updated

11 years ago
Version: other → head

Comment 1

11 years ago
Will take a lot of setup to reproduce. You might try filing this bug against HTMLUnit so they can look at it more quickly.
Priority: -- → P5

Updated

11 years ago
Status: UNCONFIRMED → RESOLVED
Last Resolved: 11 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 397868
You need to log in before you can comment on or make changes to this bug.