Changeset 2974 in webkit for trunk/JavaScriptCore/kjs


Ignore:
Timestamp:
Dec 9, 2002, 8:21:10 AM (22 years ago)
Author:
mjs
Message:

Reviewed by Ken.

  • fixed 3059637 - all articles missing at excite.com sports page
  • fixed 3065903 - most of content missing at excite.com news page

These bugs both came up because a JavaScript function has a var
declaration that collides with a function parameter name.

  • kjs/nodes.cpp: (VarDeclNode::processVarDecls): Don't set the property to undefined if a property with that name is already set on the global object. Otherwise we may clobber function parameters with undefined even before hitting a possible var initializer.
File:
1 edited

Legend:

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

    r2881 r2974  
    16581658{
    16591659  Object variable = exec->context().imp()->variableObject();
    1660   variable.put(exec,ident, Undefined(), DontDelete);
     1660
     1661  // If a variable by this name already exists, don't clobber it -
     1662  // it might be a function parameter
     1663  if (!variable.hasProperty(exec, ident)) {
     1664    variable.put(exec,ident, Undefined(), DontDelete);
     1665  }
    16611666}
    16621667
Note: See TracChangeset for help on using the changeset viewer.