Closed
Bug 71107
Opened 25 years ago
Closed 25 years ago
lexical closure scoping regression in js breaks ldap datasource
Categories
(Core :: JavaScript Engine, defect, P1)
Tracking
()
VERIFIED
FIXED
People
(Reporter: dmosedale, Assigned: shaver)
Details
(Keywords: js1.5)
Attachments
(1 file)
953 bytes,
patch
|
Details | Diff | Splinter Review |
From IRC:
<peterv> dmose: seems the inner objects don't see the variables in the
CreateDelegate function anymore
<peterv> dmose: JavaScript Error: "connection is not defined" {file:
"nsLDAPDataSource.js" line: 831}
Looking at the code, it seems possible that the scope chain of the callback
function is wrong (ie not lexically closed).
Assignee | ||
Comment 1•25 years ago
|
||
Yeah, we lose. We don't propagate heavyweightness back up the function-nesting
chain when we set it in js_EmitTree/TOK_FUNCTION.
Simple test case:
function outer () {
var outer_var = 5;
function inner() {
function way_inner() {
return outer_var;
}
return way_inner;
}
return inner;
}
js> outer()()()
/tmp/nest.js:5: ReferenceError: outer_var is not defined
Expected:
js> outer()()()
5
Patch coming right up.
Assignee | ||
Comment 2•25 years ago
|
||
Assignee | ||
Comment 3•25 years ago
|
||
I crave brendan's r and someone's sr. Phil, can you add this baby to our test
suite?
Comment 4•25 years ago
|
||
r/sr=brendan@mozilla.org.
D'oh!
/be
Comment 5•25 years ago
|
||
Yes, I will add this test now. Thanks, Mike -
Comment 6•25 years ago
|
||
Need fast r= for JS1.5 RC3.
/be
Comment 7•25 years ago
|
||
Mike's test added to JS test suite:
js/tests/js1_5/Regress/regress-71107.js
Comment 8•25 years ago
|
||
Just ran the entire JS test suite on WinNT and Linux with Mike's patch applied.
Suite now includes the regression test for this bug, above.
I got 0 errors -
Comment 9•25 years ago
|
||
r=jband
Assignee | ||
Comment 10•25 years ago
|
||
All better. Sorry about that, dmose.
Status: ASSIGNED → RESOLVED
Closed: 25 years ago
Resolution: --- → FIXED
Comment 11•25 years ago
|
||
Also ran the new regression test on the Mac - passed.
Marking VERIFIED -
Status: RESOLVED → VERIFIED
You need to log in
before you can comment on or make changes to this bug.
Description
•