Ignore:
Timestamp:
Aug 7, 2003, 12:10:01 PM (22 years ago)
Author:
mjs
Message:

Reviewed by Darin.

  • fixed 3366975 - repro hang in KJS::Value::Value entering text at eil.com
  • kjs/string_object.cpp: (StringProtoFuncImp::call): When doing a match against a regexp with the global flag set, make sure to return null rather than an empty array when there is no match. This is what other browsers do.
File:
1 edited

Legend:

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

    r3373 r4783  
    273273        if (imp)
    274274          imp->put(exec, "lastIndex", Number(lastIndex), DontDelete|DontEnum);
    275         result = exec->interpreter()->builtinArray().construct(exec, list);
     275        if (list.isEmpty()) {
     276          // if there are no matches at all, it's important to return
     277          // Null instead of an empty array, because this matches
     278          // other browsers and because Null is a false value.
     279          result = Null();
     280        } else {
     281          result = exec->interpreter()->builtinArray().construct(exec, list);
     282        }
    276283      }
    277284    }
Note: See TracChangeset for help on using the changeset viewer.