Closed
Bug 561670
Opened 16 years ago
Closed 16 years ago
Function declaration in catch block was not added to current execution context's VariableEnvironment.
Categories
(Core :: JavaScript Engine, defect)
Tracking
()
RESOLVED
DUPLICATE
of bug 434912
People
(Reporter: orangejasmine, Unassigned)
Details
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3 (.NET CLR 3.5.30729)
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3 (.NET CLR 3.5.30729)
Function declaration in catch block was not added to current execution context's VariableEnvironment.
This is not a severe bug but it seems to break ES5 spec.
IE ,Opera, Chrome, Safari produced the expected result.
Reproducible: Always
Steps to Reproduce:
1. Declare function in catch block
abc();
try {
throw 1;
} catch (e) {
function abc() { alert(123); }
}
Actual Results:
ReferenceError: abc is not defined
Expected Results:
alert popup with text '123'
Comment 1•16 years ago
|
||
No, ES5 and ES3 before it do not specify function declarations as sub-statements. This is an extension, an old one too, where we differ from IE (other engines all followed IE).
In the Harmony edition of ECMAScript (or one of them, probably the first one), the specification will include a production for Statement: FunctionDeclaration. This will bind a block-local named function, with the binding hoisted to top of block.
Marking dup of bug 434912, but there are older bugs than that one to dup. Any editbugs-capable helper who wants to clean up, please feel free.
/be
Status: UNCONFIRMED → RESOLVED
Closed: 16 years ago
Resolution: --- → DUPLICATE
You need to log in
before you can comment on or make changes to this bug.
Description
•