Changeset 15225 in webkit for trunk/JavaScriptCore
- Timestamp:
- Jul 7, 2006, 7:25:55 PM (19 years ago)
- Location:
- trunk/JavaScriptCore
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/API/JSCallbackObject.cpp
r15224 r15225 38 38 const ClassInfo JSCallbackObject::info = { "CallbackObject", 0, 0, 0 }; 39 39 40 JSCallbackObject::JSCallbackObject(JSC lassRef jsClass)40 JSCallbackObject::JSCallbackObject(JSContextRef context, JSClassRef jsClass) 41 41 : JSObject() 42 42 { 43 init( jsClass);44 } 45 46 JSCallbackObject::JSCallbackObject(JSC lassRef jsClass, JSObject* prototype)43 init(context, jsClass); 44 } 45 46 JSCallbackObject::JSCallbackObject(JSContextRef context, JSClassRef jsClass, JSObject* prototype) 47 47 : JSObject(prototype) 48 48 { 49 init( jsClass);50 } 51 52 void JSCallbackObject::init(JSC lassRef jsClass)49 init(context, jsClass); 50 } 51 52 void JSCallbackObject::init(JSContextRef context, JSClassRef jsClass) 53 53 { 54 54 m_privateData = 0; … … 59 59 do { 60 60 if (JSInitializeCallback initialize = jsClass->callbacks.initialize) 61 initialize( thisRef);61 initialize(context, thisRef); 62 62 } while ((jsClass = jsClass->parent)); 63 63 } -
trunk/JavaScriptCore/API/JSCallbackObject.h
r15133 r15225 37 37 { 38 38 public: 39 JSCallbackObject(JSC lassRef globalObjectClass);40 JSCallbackObject(JSC lassRef globalObjectClass, JSObject* prototype);39 JSCallbackObject(JSContextRef, JSClassRef); 40 JSCallbackObject(JSContextRef, JSClassRef, JSObject* prototype); 41 41 virtual ~JSCallbackObject(); 42 42 … … 76 76 JSCallbackObject(const JSCallbackObject&); 77 77 78 void init(JSC lassRef jsClass);78 void init(JSContextRef, JSClassRef); 79 79 80 80 static JSValue* cachedValueGetter(ExecState*, JSObject*, const Identifier&, const PropertySlot&); -
trunk/JavaScriptCore/API/JSContextRef.cpp
r15224 r15225 41 41 JSObject* globalObject; 42 42 if (globalObjectClass) 43 globalObject = new JSCallbackObject(globalObjectClass); 43 // FIXME: We need to pass a real ExecState here to support an initialize callback in globalObjectClass 44 globalObject = new JSCallbackObject(0, globalObjectClass); 44 45 else 45 46 globalObject = new JSObject(); -
trunk/JavaScriptCore/API/JSContextRef.h
r15224 r15225 111 111 } 112 112 #endif 113 113 114 114 #endif // JSContextRef_h -
trunk/JavaScriptCore/API/JSObjectRef.cpp
r15224 r15225 54 54 return toRef(new JSObject(jsPrototype)); // slightly more efficient 55 55 else 56 return toRef(new JSCallbackObject( jsClass, jsPrototype));56 return toRef(new JSCallbackObject(context, jsClass, jsPrototype)); 57 57 } 58 58 … … 282 282 } 283 283 284 JSStringBufferRef JSPropertyEnumeratorGetNext(JSContextRef context, JSPropertyEnumeratorRef enumerator) 285 { 286 ExecState* exec = toJS(context); 284 JSStringBufferRef JSPropertyEnumeratorGetNext(JSPropertyEnumeratorRef enumerator) 285 { 287 286 ReferenceListIterator& iterator = enumerator->iterator; 288 287 if (iterator != enumerator->list.end()) { 289 JSStringBufferRef result = toRef(iterator->getPropertyName( exec).ustring().rep());288 JSStringBufferRef result = toRef(iterator->getPropertyName().ustring().rep()); 290 289 iterator++; 291 290 return result; -
trunk/JavaScriptCore/API/JSObjectRef.h
r15224 r15225 58 58 @typedef JSInitializeCallback 59 59 @abstract The callback invoked when an object is first created. 60 @param context The execution context to use. 60 61 @param object The JSObject being created. 61 62 @discussion If you named your function Initialize, you would declare it like this: 62 63 63 void Initialize(JSObjectRef object); 64 */ 65 66 // FIXME: Needs to take a context argument, but can't because no context exists when we're creating the global object 64 void Initialize(JSContextRef context, JSObjectRef object); 65 */ 67 66 typedef void 68 (*JSInitializeCallback) (JS ObjectRef object);67 (*JSInitializeCallback) (JSContextRef context, JSObjectRef object); 69 68 70 69 /*! … … 493 492 @function 494 493 @abstract Gets a property enumerator's next property. 495 @param context The execution context to use.496 494 @param enumerator The JSPropertyEnumerator whose next property you want to get. 497 495 @result A JSStringBuffer containing the property's name, or NULL if all properties have been enumerated. 498 496 */ 499 JSStringBufferRef JSPropertyEnumeratorGetNext(JS ContextRef context, JSPropertyEnumeratorRef enumerator);497 JSStringBufferRef JSPropertyEnumeratorGetNext(JSPropertyEnumeratorRef enumerator); 500 498 501 499 /*! -
trunk/JavaScriptCore/API/testapi.c
r15224 r15225 123 123 124 124 static bool didInitialize = false; 125 static void MyObject_initialize(JS ObjectRef object)125 static void MyObject_initialize(JSContextRef context, JSObjectRef object) 126 126 { 127 127 UNUSED_PARAM(context); … … 594 594 JSPropertyEnumeratorRef enumerator = JSObjectCreatePropertyEnumerator(context, o); 595 595 int count = 0; 596 while (JSPropertyEnumeratorGetNext( context,enumerator))596 while (JSPropertyEnumeratorGetNext(enumerator)) 597 597 ++count; 598 598 JSPropertyEnumeratorRelease(enumerator); -
trunk/JavaScriptCore/ChangeLog
r15224 r15225 1 2006-07-07 Geoffrey Garen <[email protected]> 2 3 Reviewed by Maciej. 4 5 - Standardized which functions take a JSContext as an argument. The rule is: 6 if you might execute JavaScript, you take a JSContext, otherwise you don't. 7 8 The FIXME in JSObjectRef.h requires refactoring some parts of Interpreter, 9 but not API changes, so I'm putting it off until later. 10 11 * API/JSCallbackObject.cpp: 12 (KJS::JSCallbackObject::JSCallbackObject): 13 (KJS::JSCallbackObject::init): 14 * API/JSCallbackObject.h: 15 * API/JSContextRef.cpp: 16 (JSContextCreate): 17 * API/JSContextRef.h: 18 * API/JSObjectRef.cpp: 19 (JSObjectMake): 20 (JSPropertyEnumeratorGetNext): 21 * API/JSObjectRef.h: 22 * API/testapi.c: 23 (MyObject_initialize): 24 (main): 25 * JavaScriptCore.exp: 26 * kjs/array_object.cpp: 27 (ArrayInstance::setLength): 28 (ArrayInstance::pushUndefinedObjectsToEnd): 29 * kjs/nodes.cpp: 30 (ForInNode::execute): 31 * kjs/reference.cpp: 32 (KJS::Reference::getPropertyName): 33 (KJS::Reference::getValue): 34 * kjs/reference.h: 35 * kjs/scope_chain.cpp: 36 (KJS::ScopeChain::print): 37 1 38 2006-07-06 Geoffrey Garen <[email protected]> 2 39 -
trunk/JavaScriptCore/JavaScriptCore.exp
r15224 r15225 262 262 __ZNK3KJS8JSObject9toBooleanEPNS_9ExecStateE 263 263 __ZNK3KJS9ExecState18lexicalInterpreterEv 264 __ZNK3KJS9Reference15getPropertyNameE PNS_9ExecStateE264 __ZNK3KJS9Reference15getPropertyNameEv 265 265 __ZTVN3KJS19InternalFunctionImpE 266 266 __ZTVN3KJS8JSObjectE -
trunk/JavaScriptCore/kjs/array_object.cpp
r15125 r15225 252 252 Reference ref = it++; 253 253 bool ok; 254 unsigned index = ref.getPropertyName( exec).toArrayIndex(&ok);254 unsigned index = ref.getPropertyName().toArrayIndex(&ok); 255 255 if (ok && index > newLength) { 256 256 ref.deleteValue(exec); … … 374 374 Reference ref = it++; 375 375 storage[o] = ref.getValue(exec); 376 JSObject::deleteProperty(exec, ref.getPropertyName( exec));376 JSObject::deleteProperty(exec, ref.getPropertyName()); 377 377 o++; 378 378 } -
trunk/JavaScriptCore/kjs/nodes.cpp
r15224 r15225 1884 1884 1885 1885 while (propIt != propertyList.end()) { 1886 Identifier name = propIt->getPropertyName( exec);1886 Identifier name = propIt->getPropertyName(); 1887 1887 if (!v->hasProperty(exec, name)) { 1888 1888 propIt++; -
trunk/JavaScriptCore/kjs/reference.cpp
r13015 r15225 44 44 } 45 45 46 Identifier Reference::getPropertyName( ExecState*) const46 Identifier Reference::getPropertyName() const 47 47 { 48 48 if (propertyNameIsNumber && prop.isNull()) … … 56 56 if (!o || !o->isObject()) { 57 57 if (!o || o->isNull()) 58 return throwError(exec, ReferenceError, "Can't find variable: " + getPropertyName( exec).ustring());58 return throwError(exec, ReferenceError, "Can't find variable: " + getPropertyName().ustring()); 59 59 return throwError(exec, ReferenceError, "Base is not an object"); 60 60 } -
trunk/JavaScriptCore/kjs/reference.h
r13821 r15225 41 41 * (ECMA 8.7) 42 42 */ 43 Identifier getPropertyName( ExecState *exec) const;43 Identifier getPropertyName() const; 44 44 45 45 /** -
trunk/JavaScriptCore/kjs/scope_chain.cpp
r14951 r15225 49 49 fprintf(stderr, "----- [scope %p] -----\n", o); 50 50 for (ReferenceListIterator propIter = propertyList.begin(); propIter != propEnd; propIter++) { 51 Identifier name = propIter->getPropertyName( exec);51 Identifier name = propIter->getPropertyName(); 52 52 fprintf(stderr, "%s, ", name.ascii()); 53 53 }
Note:
See TracChangeset
for help on using the changeset viewer.