Ticket #69 (new defect)
Reporter Reid Burke |
Opened: 01/19/12 Last modified: 01/19/12 Status: new Type: defect |
Owner Nicholas C. Zakas |
Target Release: Priority: P3 (normal) |
|---|---|---|---|
| Summary: | Coverage instrumentation can change labelled statements causing a continue statement SyntaxError | ||
| Description: | Consider a JavaScript program that uses nested loops like this:
In this simple example, continue breaks to the while loop labelled with "testLoop". In JavaScript, an identifier used with continue can only reference a looping labeled statement (an YUI Test Coverage would instrument the above labelled statement in this manner:
In this example, the testLoop label no longer references the while loop. This code is syntactically incorrect and will raise a SyntaxError at parse time. For an interactive example, see: http://jsfiddle.net/reid/psphd/1/ For more about the behavior of the continue statement, see ECMA-262 Sec. 12.7, 3rd or 5th Edition or MDN's JS label reference. Easy to read MDN reference: http://_Sdeveloper.mozilla.org/en/JavaScript/Reference/Statements/label This bug prevents YUI's selector-css2 module from being used with YUI Test Coverage. We use a labelled looping statement here: http://_Sgithub.com/yui/yui3/blob/master/build/selector-css2/selector-css2.js#L172 |
||
| Type: | defect | Observed in Version: | development master |
| Component: | Coverage | Severity: | S2 (high) |
| Assigned To: | Nicholas C. Zakas | Target Release: | |
| Location: | Library Code | Priority: | P3 (normal) |
| Tags: | Relates To: | ||
| Browsers: | All | ||
| URL: | http://jsfiddle.net/reid/psphd/1/ | ||
| Test Information: | |||
The bug was originally reported in #49.
I opened this bug to track this defect separately.
Apologies for the HTTPS URL mojibake in the description, I'm not sure why Trac does that.