Ignore:
Timestamp:
Jun 14, 2005, 9:36:11 AM (20 years ago)
Author:
ggaren
Message:

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
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/kjs/function.cpp

    r8904 r9390  
    345345{
    346346    if (propertyName == argumentsPropertyName) {
     347        // check for locally declared arguments property
     348        ValueImp *v = getDirect(propertyName);
     349        if (v)
     350            return Value(v);
     351
     352        // default: return builtin arguments array
    347353        if (!_argumentsObject)
    348             createArgumentsObject(exec);
     354                createArgumentsObject(exec);
    349355        return Value(_argumentsObject);
    350356    }
    351357    return ObjectImp::get(exec, propertyName);
    352 }
    353 
    354 void ActivationImp::put(ExecState *exec, const Identifier &propertyName, const Value &value, int attr)
    355 {
    356     if (propertyName == argumentsPropertyName) {
    357         // FIXME: Do we need to allow overwriting this?
    358         return;
    359     }
    360     ObjectImp::put(exec, propertyName, value, attr);
    361358}
    362359
Note: See TracChangeset for help on using the changeset viewer.