Changeset 36016 in webkit for trunk/JavaScriptCore/API
- Timestamp:
- Sep 1, 2008, 2:22:54 PM (17 years ago)
- Location:
- trunk/JavaScriptCore/API
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/API/JSCallbackObject.h
r35900 r36016 37 37 class JSCallbackObject : public Base { 38 38 public: 39 JSCallbackObject(ExecState*, JSClassRef, JS Value* prototype, void* data);40 JSCallbackObject(JS ClassRef);39 JSCallbackObject(ExecState*, JSClassRef, JSObject* prototype, void* data); 40 JSCallbackObject(JSGlobalData*, JSClassRef); 41 41 virtual ~JSCallbackObject(); 42 42 … … 55 55 virtual bool getOwnPropertySlot(ExecState*, unsigned, PropertySlot&); 56 56 57 virtual void put(ExecState*, const Identifier&, JSValue*); 58 virtual void put(ExecState*, unsigned, JSValue*); 57 virtual void put(ExecState*, const Identifier&, JSValue*, PutPropertySlot&); 59 58 60 59 virtual bool deleteProperty(ExecState*, const Identifier&); -
trunk/JavaScriptCore/API/JSCallbackObjectFunctions.h
r35900 r36016 41 41 42 42 template <class Base> 43 JSCallbackObject<Base>::JSCallbackObject(ExecState* exec, JSClassRef jsClass, JS Value* prototype, void* data)43 JSCallbackObject<Base>::JSCallbackObject(ExecState* exec, JSClassRef jsClass, JSObject* prototype, void* data) 44 44 : Base(prototype) 45 45 , m_callbackObjectData(new JSCallbackObjectData(data, jsClass)) … … 51 51 // FIXME: Move this into a separate JSGlobalCallbackObject class derived from this one. 52 52 template <class Base> 53 JSCallbackObject<Base>::JSCallbackObject(JSClassRef jsClass) 54 : m_callbackObjectData(new JSCallbackObjectData(0, jsClass)) 53 JSCallbackObject<Base>::JSCallbackObject(JSGlobalData* globalData, JSClassRef jsClass) 54 : Base(globalData) 55 , m_callbackObjectData(new JSCallbackObjectData(0, jsClass)) 55 56 { 56 57 ASSERT(Base::isGlobalObject()); … … 153 154 154 155 template <class Base> 155 void JSCallbackObject<Base>::put(ExecState* exec, const Identifier& propertyName, JSValue* value )156 void JSCallbackObject<Base>::put(ExecState* exec, const Identifier& propertyName, JSValue* value, PutPropertySlot& slot) 156 157 { 157 158 JSContextRef ctx = toRef(exec); … … 194 195 } 195 196 196 return Base::put(exec, propertyName, value); 197 } 198 199 template <class Base> 200 void JSCallbackObject<Base>::put(ExecState* exec, unsigned propertyName, JSValue* value) 201 { 202 return put(exec, Identifier::from(exec, propertyName), value); 197 return Base::put(exec, propertyName, value, slot); 203 198 } 204 199 -
trunk/JavaScriptCore/API/JSContextRef.cpp
r35917 r36016 68 68 69 69 if (!globalObjectClass) { 70 JSGlobalObject* globalObject = new (globalData.get()) JSGlobalObject ;70 JSGlobalObject* globalObject = new (globalData.get()) JSGlobalObject(globalData.get()); 71 71 return JSGlobalContextRetain(toGlobalRef(globalObject->globalExec())); 72 72 } 73 73 74 JSGlobalObject* globalObject = new (globalData.get()) JSCallbackObject<JSGlobalObject>(global ObjectClass);74 JSGlobalObject* globalObject = new (globalData.get()) JSCallbackObject<JSGlobalObject>(globalData.get(), globalObjectClass); 75 75 ExecState* exec = globalObject->globalExec(); 76 76 JSValue* prototype = globalObjectClass->prototype(exec); 77 77 if (!prototype) 78 78 prototype = jsNull(); 79 globalObject->reset (prototype);79 globalObject->resetPrototype(prototype); 80 80 return JSGlobalContextRetain(toGlobalRef(exec)); 81 81 } -
trunk/JavaScriptCore/API/JSObjectRef.cpp
r36006 r36016 75 75 return toRef(new (exec) JSObject(exec->lexicalGlobalObject()->objectPrototype())); // slightly more efficient 76 76 77 JS Value* jsPrototype = jsClass->prototype(exec);77 JSObject* jsPrototype = jsClass->prototype(exec); 78 78 if (!jsPrototype) 79 79 jsPrototype = exec->lexicalGlobalObject()->objectPrototype(); … … 142 142 JSValue* jsValue = toJS(value); 143 143 144 jsObject->setPrototype(jsValue );144 jsObject->setPrototype(jsValue->isObject() ? jsValue : jsNull()); 145 145 } 146 146 … … 185 185 if (attributes && !jsObject->hasProperty(exec, name)) 186 186 jsObject->putWithAttributes(exec, name, jsValue, attributes); 187 else 188 jsObject->put(exec, name, jsValue); 187 else { 188 PutPropertySlot slot; 189 jsObject->put(exec, name, jsValue, slot); 190 } 189 191 190 192 if (exec->hadException()) {
Note:
See TracChangeset
for help on using the changeset viewer.