mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 22:32:46 +00:00
Fix bug 132217.
This commit is contained in:
parent
db147304c7
commit
7f70eb708f
@ -1399,9 +1399,20 @@ public class Interpreter extends LabelTable {
|
||||
if (id.itsName.length() == 0)
|
||||
return;
|
||||
if ((id.itsFunctionType == FunctionNode.FUNCTION_STATEMENT &&
|
||||
fn.itsClosure == null) ||
|
||||
(id.itsFunctionType == FunctionNode.FUNCTION_EXPRESSION_STATEMENT &&
|
||||
fn.itsClosure != null))
|
||||
fn.itsClosure == null))
|
||||
{
|
||||
try {
|
||||
// ECMA specifies that functions defined in global and
|
||||
// function scope should have DONTDELETE set.
|
||||
((ScriptableObject) scope).defineProperty(fn.itsData.itsName,
|
||||
fn, ScriptableObject.PERMANENT);
|
||||
} catch (ClassCastException e) {
|
||||
ScriptRuntime.setProp(scope, fn.itsData.itsName, fn, scope);
|
||||
}
|
||||
}
|
||||
|
||||
if (id.itsFunctionType == FunctionNode.FUNCTION_EXPRESSION_STATEMENT &&
|
||||
fn.itsClosure != null)
|
||||
{
|
||||
ScriptRuntime.setProp(scope, fn.itsData.itsName, fn, scope);
|
||||
}
|
||||
|
@ -2004,8 +2004,14 @@ public class ScriptRuntime {
|
||||
{
|
||||
fn.setPrototype(ScriptableObject.getClassPrototype(scope, "Function"));
|
||||
fn.setParentScope(scope);
|
||||
if (doSetName)
|
||||
setName(scope, fn, scope, fnName);
|
||||
if (doSetName) {
|
||||
try {
|
||||
((ScriptableObject) scope).defineProperty(fnName, fn,
|
||||
ScriptableObject.PERMANENT);
|
||||
} catch (ClassCastException e) {
|
||||
setName(scope, fn, scope, fnName);
|
||||
}
|
||||
}
|
||||
return fn;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user