Closed Bug 647225 Opened 14 years ago Closed 12 years ago

Declaring an uninitialized JS var triggers a scoping bug

Categories

(Core :: JavaScript Engine, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: nicholas.j.santos, Unassigned)

References

Details

Attachments

(1 file)

User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.16) Gecko/20110319 Firefox/3.6.16 Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.16) Gecko/20110319 Firefox/3.6.16 See repro case below. When the VAR keyword is used twice in the same scope, where one of the VAR initializations is undeclared, the JS engine seems to scope the variable incorrectly. Reproducible: Always Steps to Reproduce: 1. Run the following code in the console: function f() {var x; var y=function() { alert(x); }; var x = 5; y(x); } f(); Actual Results: alerts "undefined" Expected Results: alerts "5" IE and Chrome perform correctly. Reproduced on FF3.6/Win and the nightly FF/Linux build (as of 3/31/11)
We shouldn't have a lambda_fc here.
Status: UNCONFIRMED → NEW
Ever confirmed: true
OS: Windows 7 → Windows XP
Any action on this? I would really like to remove the hacks around this from the Closure Compiler one day.
Original testcase worksforme, as does the shell testcase I attached.
Almost certainly fixed in bug 730497 which removed flat closures. Fix shipped in Firefox 14 back in July.
Status: NEW → RESOLVED
Closed: 12 years ago
Depends on: 730497
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: