26 #include "function_object.h" |
26 #include "function_object.h" |
27 #include <stdio.h> |
27 #include <stdio.h> |
28 |
28 |
29 using namespace KJS; |
29 using namespace KJS; |
30 |
30 |
|
31 static const Identifier* hasOwnPropertyPropertyName = 0; |
|
32 static const Identifier* propertyIsEnumerablePropertyName = 0; |
|
33 static const Identifier* isPrototypeOfPropertyName = 0; |
|
34 static const Identifier* defineGetterPropertyName = 0; |
|
35 static const Identifier* defineSetterPropertyName = 0; |
|
36 static const Identifier* lookupGetterPropertyName = 0; |
|
37 static const Identifier* lookupSetterPropertyName = 0; |
|
38 |
|
39 |
31 // ------------------------------ ObjectPrototype -------------------------------- |
40 // ------------------------------ ObjectPrototype -------------------------------- |
32 |
41 |
33 ObjectPrototype::ObjectPrototype(ExecState* exec, FunctionPrototype* funcProto) |
42 ObjectPrototype::ObjectPrototype(ExecState* exec, FunctionPrototype* funcProto) |
34 : JSObject() // [[Prototype]] is null |
43 : JSObject() // [[Prototype]] is null |
35 { |
44 { |
36 static const Identifier* hasOwnPropertyPropertyName = new Identifier("hasOwnProperty"); |
45 if(!hasOwnPropertyPropertyName) |
37 static const Identifier* propertyIsEnumerablePropertyName = new Identifier("propertyIsEnumerable"); |
46 hasOwnPropertyPropertyName = new Identifier("hasOwnProperty"); |
38 static const Identifier* isPrototypeOfPropertyName = new Identifier("isPrototypeOf"); |
47 if(!propertyIsEnumerablePropertyName) |
39 static const Identifier* defineGetterPropertyName = new Identifier("__defineGetter__"); |
48 propertyIsEnumerablePropertyName = new Identifier("propertyIsEnumerable"); |
40 static const Identifier* defineSetterPropertyName = new Identifier("__defineSetter__"); |
49 if(!isPrototypeOfPropertyName) |
41 static const Identifier* lookupGetterPropertyName = new Identifier("__lookupGetter__"); |
50 isPrototypeOfPropertyName = new Identifier("isPrototypeOf"); |
42 static const Identifier* lookupSetterPropertyName = new Identifier("__lookupSetter__"); |
51 if(!defineGetterPropertyName) |
|
52 defineGetterPropertyName = new Identifier("__defineGetter__"); |
|
53 if(!defineSetterPropertyName) |
|
54 defineSetterPropertyName = new Identifier("__defineSetter__"); |
|
55 if(!lookupGetterPropertyName) |
|
56 lookupGetterPropertyName = new Identifier("__lookupGetter__"); |
|
57 if(!lookupSetterPropertyName) |
|
58 lookupSetterPropertyName = new Identifier("__lookupSetter__"); |
43 |
59 |
44 putDirectFunction(new ObjectProtoFunc(exec, funcProto, ObjectProtoFunc::ToString, 0, exec->propertyNames().toString), DontEnum); |
60 putDirectFunction(new ObjectProtoFunc(exec, funcProto, ObjectProtoFunc::ToString, 0, exec->propertyNames().toString), DontEnum); |
45 putDirectFunction(new ObjectProtoFunc(exec, funcProto, ObjectProtoFunc::ToLocaleString, 0, exec->propertyNames().toLocaleString), DontEnum); |
61 putDirectFunction(new ObjectProtoFunc(exec, funcProto, ObjectProtoFunc::ToLocaleString, 0, exec->propertyNames().toLocaleString), DontEnum); |
46 putDirectFunction(new ObjectProtoFunc(exec, funcProto, ObjectProtoFunc::ValueOf, 0, exec->propertyNames().valueOf), DontEnum); |
62 putDirectFunction(new ObjectProtoFunc(exec, funcProto, ObjectProtoFunc::ValueOf, 0, exec->propertyNames().valueOf), DontEnum); |
47 putDirectFunction(new ObjectProtoFunc(exec, funcProto, ObjectProtoFunc::HasOwnProperty, 1, *hasOwnPropertyPropertyName), DontEnum); |
63 putDirectFunction(new ObjectProtoFunc(exec, funcProto, ObjectProtoFunc::HasOwnProperty, 1, *hasOwnPropertyPropertyName), DontEnum); |
190 JSValue* ObjectObjectImp::callAsFunction(ExecState* exec, JSObject* /*thisObj*/, const List &args) |
206 JSValue* ObjectObjectImp::callAsFunction(ExecState* exec, JSObject* /*thisObj*/, const List &args) |
191 { |
207 { |
192 return construct(exec, args); |
208 return construct(exec, args); |
193 } |
209 } |
194 |
210 |
|
211 struct cleanupStaticObjectObject { |
|
212 ~cleanupStaticObjectObject() |
|
213 { |
|
214 delete hasOwnPropertyPropertyName; |
|
215 delete propertyIsEnumerablePropertyName; |
|
216 delete isPrototypeOfPropertyName; |
|
217 delete defineGetterPropertyName; |
|
218 delete defineSetterPropertyName; |
|
219 delete lookupGetterPropertyName; |
|
220 delete lookupSetterPropertyName; |
|
221 |
|
222 hasOwnPropertyPropertyName = 0; |
|
223 propertyIsEnumerablePropertyName = 0; |
|
224 isPrototypeOfPropertyName = 0; |
|
225 defineGetterPropertyName = 0; |
|
226 defineSetterPropertyName = 0; |
|
227 lookupGetterPropertyName = 0; |
|
228 lookupSetterPropertyName = 0; |
|
229 |
|
230 } |
|
231 }; |
|
232 static cleanupStaticObjectObject deleteStaticObjectObject; |
|
233 |