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)
Tracking
()
RESOLVED
FIXED
People
(Reporter: nicholas.j.santos, Unassigned)
References
Details
Attachments
(1 file)
95 bytes,
text/plain
|
Details |
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)
![]() |
||
Comment 1•14 years ago
|
||
We shouldn't have a lambda_fc here.
![]() |
||
Updated•14 years ago
|
Status: UNCONFIRMED → NEW
Ever confirmed: true
Updated•14 years ago
|
OS: Windows 7 → Windows XP
Comment 2•12 years ago
|
||
Any action on this? I would really like to remove the hacks around this from the Closure Compiler one day.
![]() |
||
Comment 3•12 years ago
|
||
Original testcase worksforme, as does the shell testcase I attached.
![]() |
||
Comment 4•12 years ago
|
||
Almost certainly fixed in bug 730497 which removed flat closures. Fix shipped in Firefox 14 back in July.
You need to log in
before you can comment on or make changes to this bug.
Description
•