No layout tests added because this change fixes existing tests:
ecma/ExecutionContexts/10.1.6.js
ecma_3/Function/regress-94506.js
js1_4/Functions/function-001.js
Reviewed by cblu.
* kjs/function.cpp:
(KJS::ActivationImp::get): get now checks for an "arguments" property defined in the local variable object
before trying to return the built-in arguments array.
* kjs/function.h: ActivationImp::put no longer overrides ObjectImp::put
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@9390
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2005-06-14 Geoffrey Garen <ggaren@apple.com>
+
+ Fixed: <rdar://problem/4147745> JavaScript discards locally defined "arguments" property
+
+ No layout tests added because this change fixes existing tests:
+ ecma/ExecutionContexts/10.1.6.js
+ ecma_3/Function/regress-94506.js
+ js1_4/Functions/function-001.js
+
+ Reviewed by cblu.
+
+ * kjs/function.cpp:
+ (KJS::ActivationImp::get): get now checks for an "arguments" property defined in the local variable object
+ before trying to return the built-in arguments array.
+
+ * kjs/function.h: ActivationImp::put no longer overrides ObjectImp::put
+
2005-06-10 Darin Adler <darin@apple.com>
Change by Mark Rowe <opendarwin.org@bdash.net.nz>.
Value ActivationImp::get(ExecState *exec, const Identifier &propertyName) const
{
if (propertyName == argumentsPropertyName) {
+ // check for locally declared arguments property
+ ValueImp *v = getDirect(propertyName);
+ if (v)
+ return Value(v);
+
+ // default: return builtin arguments array
if (!_argumentsObject)
- createArgumentsObject(exec);
+ createArgumentsObject(exec);
return Value(_argumentsObject);
}
return ObjectImp::get(exec, propertyName);
}
-void ActivationImp::put(ExecState *exec, const Identifier &propertyName, const Value &value, int attr)
-{
- if (propertyName == argumentsPropertyName) {
- // FIXME: Do we need to allow overwriting this?
- return;
- }
- ObjectImp::put(exec, propertyName, value, attr);
-}
-
bool ActivationImp::hasProperty(ExecState *exec, const Identifier &propertyName) const
{
if (propertyName == argumentsPropertyName)
ActivationImp(FunctionImp *function, const List &arguments);
virtual Value get(ExecState *exec, const Identifier &propertyName) const;
- virtual void put(ExecState *exec, const Identifier &propertyName, const Value &value, int attr = None);
virtual bool hasProperty(ExecState *exec, const Identifier &propertyName) const;
virtual bool deleteProperty(ExecState *exec, const Identifier &propertyName);