swallowzhang / jsdoc-toolkit

Automatically exported from code.google.com/p/jsdoc-toolkit
0 stars 0 forks source link

JSDOC.handlers is sometimes undefined #217

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Sometimes when running source code through JsDoc-Toolkit the variable
JSDOC.handlers is undefined. This causes an issue where Rhino throws
"TypeError: can't use instanceof on a non-object". This is in JsDoc-Toolkit
2.1.0, and I could not find anywhere in the source where JSDOC.handlers is
actually filled with anything.

I traced this problem all the way down to line 91 of JsDoc.js
The original line is this:
<code>
return (ext.indexOf(thisExt) > -1 || thisExt in JSDOC.handlers); // we're
only interested in files with certain extensions
</code>

I propose a check here instead:
<code>
var xchk = ext.indexOf(thisExt) > -1; // we're only interested in files
with certain extensions
if(!xchk && JSDOC.handlers !== undefined) {
    return (thisExt in JSDOC.handlers);
}
return (xchk);
</code>

From test's I've done on two projects which use 2.1.0, both have an
undefined value for JSDOC.handlers. However, only one project causes Rhino
to blow up as a result of this problem. I caught the error and found the
source of the problem to be a file with a "txt" extension in the project
with the issue.

Other than attempting to avoid the issue, I have no idea about the real
cause of this issue and can only assume it is a Rhino problem. I have not
investigated into Rhino at this time. If it really is a Rhino problem, then
maybe upgrading Rhino used will help.

Original issue reported on code.google.com by mcbain....@gmail.com on 11 May 2009 at 7:23

GoogleCodeExporter commented 8 years ago
erm, well ... the title of my issue doesn't really fit. I started writing it, 
then
figured out more, after which I edited the post (but not the title) before 
submitting.

Original comment by mcbain....@gmail.com on 11 May 2009 at 7:24

GoogleCodeExporter commented 8 years ago
References to JSDOC.handlers was removed in version 2.2.0 (released today).

Original comment by micmath on 15 Jun 2009 at 1:50