Bug 186156 - "JSLint error: undefined" on any/all JavaScript source files with current version of jslint.js
Summary: "JSLint error: undefined" on any/all JavaScript source files with current ver...
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Webtools.ATF (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-05-09 09:57 EDT by Edward Pring CLA
Modified: 2009-07-08 15:35 EDT (History)
2 users (show)

See Also:


Attachments
current version of jslint.js (from http://www.jslint.com/fulljslint.js) (100.35 KB, text/plain)
2007-05-09 09:59 EDT, Edward Pring CLA
no flags Details
downloaded from http://www.jslint.com/fulljslint.js, and renamed to jslint.js (100.23 KB, application/x-javascript)
2007-05-26 16:21 EDT, Manoj Chavda CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Edward Pring CLA 2007-05-09 09:57:57 EDT
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.
Comment 1 Edward Pring CLA 2007-05-09 09:59:47 EDT
Created attachment 66467 [details]
current version of jslint.js (from http://www.jslint.com/fulljslint.js)
Comment 2 Robert Goodman CLA 2007-05-21 18:24:13 EDT
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. 
Comment 3 Gino Bustelo CLA 2007-05-23 14:45:24 EDT
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.
Comment 4 Gino Bustelo CLA 2007-05-23 18:10:17 EDT
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.
Comment 5 Manoj Chavda CLA 2007-05-26 16:21:23 EDT
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)
Comment 6 Robert Goodman CLA 2007-06-04 11:05:12 EDT
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 === ':') {