SVN commit 636735 by porten: KDE 3 port of caller property implementation (r636732) M +5 -0 ChangeLog M +15 -0 function.cpp M +1 -0 identifier.cpp M +1 -0 identifier.h --- branches/KDE/3.5/kdelibs/kjs/ChangeLog #636734:636735 @@ -1,3 +1,8 @@ +2007-02-23 Harri Porten + + * function.cpp: implemented caller property as requested by + bug report #132039 from Edward Rudd. + 2007-02-22 Harri Porten * keywords.table: unreserve "class" keyword as it is for FF >= --- branches/KDE/3.5/kdelibs/kjs/function.cpp #636734:636735 @@ -511,6 +511,21 @@ return Number(count); } + if (propertyName == callerPropertyName) { + ContextImp *context = exec->context().imp(); + while (context) { + if (context->function() == this) { + FunctionImp *f = context->callingContext()->function(); + if (f) + return Value(f); + else + return Null(); + } + context = context->callingContext(); + } + return Null(); + } + return InternalFunctionImp::get(exec, propertyName); } --- branches/KDE/3.5/kdelibs/kjs/identifier.cpp #636734:636735 @@ -49,6 +49,7 @@ extern const Identifier argumentsPropertyName("arguments"); extern const Identifier calleePropertyName("callee"); +extern const Identifier callerPropertyName("caller"); extern const Identifier constructorPropertyName("constructor"); extern const Identifier lengthPropertyName("length"); extern const Identifier messagePropertyName("message"); --- branches/KDE/3.5/kdelibs/kjs/identifier.h #636734:636735 @@ -139,6 +139,7 @@ KJS_EXPORT extern const Identifier argumentsPropertyName; KJS_EXPORT extern const Identifier calleePropertyName; + KJS_EXPORT extern const Identifier callerPropertyName; KJS_EXPORT extern const Identifier constructorPropertyName; KJS_EXPORT extern const Identifier lengthPropertyName; KJS_EXPORT extern const Identifier messagePropertyName;