Changeset 5480 in webkit for trunk/JavaScriptCore/kjs/nodes.cpp


Ignore:
Timestamp:
Nov 13, 2003, 2:53:00 PM (22 years ago)
Author:
mjs
Message:

Reviewed by John.

  • fixed 3472562 - Null or Undefined variables passed to IN operator cause javascript exceptions
  • kjs/nodes.cpp: (ForInNode::execute): If the in value is null or undefined, bail out early, since attempting to iterate its properties will throw an exception.
File:
1 edited

Legend:

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

    r5356 r5480  
    20742074
    20752075  e = expr->evaluate(exec);
     2076
     2077  // for Null and Undefined, we want to make sure not to go through
     2078  // the loop at all, because their object wrappers will have a
     2079  // property list but will throw an exception if you attempt to
     2080  // access any property.
     2081  if (e.type() == UndefinedType || e.type() == NullType) {
     2082    return Completion(Normal, retval);
     2083  }
     2084
    20762085  KJS_CHECKEXCEPTION
    20772086  v = e.toObject(exec);
Note: See TracChangeset for help on using the changeset viewer.