Changeset 11805 in webkit for trunk/JavaScriptCore/kjs


Ignore:
Timestamp:
Dec 29, 2005, 3:38:57 AM (19 years ago)
Author:
ggaren
Message:

Patch by Maks Orlovich, reviewed by mjs.

This has 2 very minor fixes, covered by KJS testsuite:

  1. Enumerates string indices in property list (with the same bug as array object has in corresponding code). This is a mozilla emulation thing.
  2. Permits properties with integer names in prototypes to be found
  • kjs/string_object.cpp: (StringInstance::getOwnPropertySlot): (StringInstanceImp::propList):
  • kjs/string_object.h:
Location:
trunk/JavaScriptCore/kjs
Files:
2 edited

Legend:

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

    r11646 r11805  
    2929#include "interpreter.h"
    3030#include "operations.h"
     31#include "reference_list.h"
    3132#include "regexp.h"
    3233#include "regexp_object.h"
     
    7677    const UString s = internalValue()->toString(exec);
    7778    const unsigned length = s.size();
    78     if (index >= length)
    79       return false;
     79    if (index < length) {
    8080    slot.setCustomIndex(this, index, indexGetter);
    8181    return true;
     82  }
    8283  }
    8384
     
    9798    return false;
    9899  return JSObject::deleteProperty(exec, propertyName);
     100}
     101
     102ReferenceList StringInstance::propList(ExecState *exec, bool recursive)
     103{
     104  ReferenceList properties = JSObject::propList(exec,recursive);
     105
     106  //### FIXME: should avoid duplicates with prototype
     107  UString str = internalValue()->toString(exec);
     108  for (int i = 0; i < str.size(); i++)
     109    properties.append(Reference(this, i));
     110  return properties;
    99111}
    100112
  • trunk/JavaScriptCore/kjs/string_object.h

    r11566 r11805  
    3636    virtual void put(ExecState *exec, const Identifier &propertyName, JSValue *value, int attr = None);
    3737    virtual bool deleteProperty(ExecState *exec, const Identifier &propertyName);
     38    virtual ReferenceList propList(ExecState *exec, bool recursive);
    3839
    3940    virtual const ClassInfo *classInfo() const { return &info; }
Note: See TracChangeset for help on using the changeset viewer.