Community
Participate
Working Groups
Using atf-0.2.1-v200704051500 with the 2007-05-07 version of http://www.jslint.com/fulljslint.js (renamed to "jslint.js"), the "validate" operation on any JavaScript file creates an entry in the Problems view that says "JSLint error: undefined" on the first line of source code.
Created attachment 66467 [details] current version of jslint.js (from http://www.jslint.com/fulljslint.js)
The problem seems to be caused by variable t.id in function statement() in the jslint.js file being undefined when running in Rhino. This doesn't occur when running when running the same file in the browser. If it is possible, the simplest solution may be to make an old version available until the problem can be resolved.
I confirmed that the problem is specific to running in Rhino and is not something that we are doing wrong in our ATF Java code. I ran then latest fulljslint.js with the rhino.js stub available from http://jslint.com/rhino/rhino.js using command line Rhino and still saw the problem. This test did not involve ATF nor eclipse, it was direct call to Rhino's Main. Sent a note to Douglas Crockford to see if he has any ideas.
Thanks to Douglas Crockford for the info... Apparently in Rhino the expression undefined || 0 evaluates to undefined, whereas in the browsers it evaluates to 0. This is what's causing the problem in ATF since we use Rhino to embed jslint.
Created attachment 68860 [details] downloaded from http://www.jslint.com/fulljslint.js, and renamed to jslint.js as per Robert Goodman, I was requested to attach my version of jslint.js to this bug. My original email: I’ve followed the instructions on http://www.eclipse.org/atf/downloads/index_build.php?plat=all&buildID=0.2.1-v200704051500&XULPlugin=true I installed eclipse WTP 1.5.2 (fresh install), then installed ATF (atf-0.2.1-v200704051500.zip). In Windows | Preferences | ATF | JavaScript Validation, I set the “JSLint Location” value to the location of my jslint.js file. When I save a JSP page (with javascript), I get the a popup with the title “JavaScript JSLint Validator” and text “org.mozilla.javascript.NativeString”. The trace below appears in my .metadata/.log file. !SESSION 2007-05-25 12:12:02.227 ----------------------------------------------- eclipse.buildId=M20060921-0945 java.version=1.5.0_11 java.vendor=Sun Microsystems Inc. BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=en_ZA Command-line arguments: -os win32 -ws win32 -arch x86 !ENTRY org.eclipse.atf.javascript.validator 4 4 2007-05-25 12:12:18.064 !MESSAGE org.mozilla.javascript.NativeString !STACK 0 java.lang.ClassCastException: org.mozilla.javascript.NativeString at org.eclipse.atf.javascript.internal.validation.jslint.JSLintError.<init>(Unknown Source) at org.eclipse.atf.javascript.internal.validation.jslint.JSLint.lint(Unknown Source) at org.eclipse.atf.javascript.internal.validation.JSLintValidator.validateString(Unknown Source) at org.eclipse.atf.javascript.internal.validation.JSAbstractValidator.validateDOM(Unknown Source) at org.eclipse.atf.javascript.internal.validation.JSAbstractValidator.validateFile(Unknown Source) at org.eclipse.atf.javascript.internal.validation.JSAbstractValidator.validateDelta(Unknown Source) at org.eclipse.atf.javascript.internal.validation.JSAbstractValidator.validate(Unknown Source) at org.eclipse.atf.javascript.internal.validation.JSAbstractValidator.validateInJob(Unknown Source) at org.eclipse.wst.validation.internal.operations.ValidatorJob.run(ValidatorJob.java:70) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:58)
A patched version of JSLint has been made available. The site ATF site has been updated with the new URL. It ends up that the Bug is in Rhino which ATF uses to run JSLint, but it was easier to patch JSLint. The plans are to use this patched version of JSLint until JSLint is replaced. Just for reference we changed line 1430 which is if (t.identifier && !t.reserved && peek().id === ':') { to if (t.identifier && !t.reserved && peek(0).id === ':') {