Closed Bug 1054998 Opened 12 years ago Closed 11 years ago

Closures created by expressions in the formal parameter list should not have visibility of declarations in the function body

Categories

(Core :: JavaScript Engine, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 1022967

People

(Reporter: amjad.masad, Unassigned)

Details

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.143 Safari/537.36 Steps to reproduce: Open firefox console and evaluate: function foo(bar=function(){ console.log(x) }){ var x = 1; bar(); } foo(); Actual results: logs "1" to the console Expected results: A ReferenceError should've been thrown because x is only defined inside the function declaration body and the closure created in the default parameter expression shouldn't have access to the function's scope.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.