Closed Bug 635450 Opened 13 years ago Closed 13 years ago

Validator does not flag errors in for loop bodies.

Categories

(addons.mozilla.org Graveyard :: Admin/Editor Tools, defect)

defect
Not set
major

Tracking

(Not tracked)

RESOLVED FIXED
5.12.12

People

(Reporter: kmag, Assigned: basta)

Details

Attachments

(1 file)

User-Agent:       Mozilla/5.0 (X11; Linux x86_64; rv:2.0b12pre) Gecko/20110216 Firefox/4.0b12pre
Build Identifier: 

It seems that for loop bodies are entirely ignored by the JavaScript validator. While and do-while loops are unaffected. The attached XPI contains the following code fragments, and while the errors in the former set are flagged, those in the latter set are not:

eval("foo");
setTimeout("foo");
document.createElement("script");
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPCOM");

for (var i=0; i < 1; i++) {
    eval("foo");
    setTimeout("foo");
    document.createElement("script");
    netscape.security.PrivilegeManager.enablePrivilege("UniversalXPCOM");
}


Reproducible: Always
Attached file Failing XPI
Assignee: nobody → mbasta
Target Milestone: --- → 5.12.12
This might be because the interface for ForStatement nodes changed. Are you running your tests locally? If so, what build of Spidermonkey are you on?

I'll go ahead and check the docs.
Yup, ForStatement has a "body" element. Updated.

https://github.com/mattbasta/amo-validator/commit/e5c5f798bfa17b17b73189eec43ef7dd39f6b03f
Status: UNCONFIRMED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Product: addons.mozilla.org → addons.mozilla.org Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: