Changeset 48492 in webkit
- Timestamp:
- Sep 17, 2009 3:23:37 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r48491 r48492 1 2009-09-17 Anders Carlsson <andersca@apple.com> 2 3 Reviewed by Oliver Hunt. 4 5 <rdar://problem/7007541> 6 CrashTracer: 4800+ crashes in Safari at com.apple.WebKit • WTF::HashTableIterator... 7 8 Make RuntimeObjectImp more robust against m_instance being a null (which can happen if an OOP plug-in 9 crashes while we're calling into it). 10 11 * bridge/runtime_object.cpp: 12 (JSC::RuntimeObjectImp::RuntimeObjectImp): 13 (JSC::RuntimeObjectImp::~RuntimeObjectImp): 14 (JSC::RuntimeObjectImp::invalidate): 15 (JSC::RuntimeObjectImp::fallbackObjectGetter): 16 (JSC::RuntimeObjectImp::fieldGetter): 17 (JSC::RuntimeObjectImp::methodGetter): 18 (JSC::RuntimeObjectImp::getOwnPropertySlot): 19 (JSC::RuntimeObjectImp::getOwnPropertyDescriptor): 20 (JSC::RuntimeObjectImp::put): 21 (JSC::RuntimeObjectImp::defaultValue): 22 (JSC::RuntimeObjectImp::getCallData): 23 (JSC::RuntimeObjectImp::getConstructData): 24 (JSC::RuntimeObjectImp::getPropertyNames): 25 * bridge/runtime_object.h: 26 (JSC::RuntimeObjectImp::getInternalInstance): 27 1 28 2009-09-17 Yury Semikhatsky <yurys@chromium.org> 2 29 -
trunk/WebCore/bridge/runtime_object.cpp
r48336 r48492 41 41 const ClassInfo RuntimeObjectImp::s_info = { "RuntimeObject", 0, 0, 0 }; 42 42 43 RuntimeObjectImp::RuntimeObjectImp(ExecState* exec, PassRefPtr<Instance> i )43 RuntimeObjectImp::RuntimeObjectImp(ExecState* exec, PassRefPtr<Instance> instance) 44 44 // FIXME: deprecatedGetDOMStructure uses the prototype off of the wrong global object 45 45 // We need to pass in the right global object for "i". 46 46 : JSObject(deprecatedGetDOMStructure<RuntimeObjectImp>(exec)) 47 , instance(i)48 { 49 instance->rootObject()->addRuntimeObject(this);50 } 51 52 RuntimeObjectImp::RuntimeObjectImp(ExecState*, PassRefPtr<Structure> structure, PassRefPtr<Instance> i )47 , m_instance(instance) 48 { 49 m_instance->rootObject()->addRuntimeObject(this); 50 } 51 52 RuntimeObjectImp::RuntimeObjectImp(ExecState*, PassRefPtr<Structure> structure, PassRefPtr<Instance> instance) 53 53 : JSObject(structure) 54 , instance(i)55 { 56 instance->rootObject()->addRuntimeObject(this);54 , m_instance(instance) 55 { 56 m_instance->rootObject()->addRuntimeObject(this); 57 57 } 58 58 59 59 RuntimeObjectImp::~RuntimeObjectImp() 60 60 { 61 if ( instance)62 instance->rootObject()->removeRuntimeObject(this);61 if (m_instance) 62 m_instance->rootObject()->removeRuntimeObject(this); 63 63 } 64 64 65 65 void RuntimeObjectImp::invalidate() 66 66 { 67 ASSERT( instance);68 instance = 0;67 ASSERT(m_instance); 68 m_instance = 0; 69 69 } 70 70 … … 72 72 { 73 73 RuntimeObjectImp* thisObj = static_cast<RuntimeObjectImp*>(asObject(slot.slotBase())); 74 RefPtr<Instance> instance = thisObj-> instance;74 RefPtr<Instance> instance = thisObj->m_instance; 75 75 76 76 if (!instance) … … 90 90 { 91 91 RuntimeObjectImp* thisObj = static_cast<RuntimeObjectImp*>(asObject(slot.slotBase())); 92 RefPtr<Instance> instance = thisObj-> instance;92 RefPtr<Instance> instance = thisObj->m_instance; 93 93 94 94 if (!instance) … … 109 109 { 110 110 RuntimeObjectImp* thisObj = static_cast<RuntimeObjectImp*>(asObject(slot.slotBase())); 111 RefPtr<Instance> instance = thisObj-> instance;111 RefPtr<Instance> instance = thisObj->m_instance; 112 112 113 113 if (!instance) … … 127 127 bool RuntimeObjectImp::getOwnPropertySlot(ExecState *exec, const Identifier& propertyName, PropertySlot& slot) 128 128 { 129 if (! instance) {129 if (!m_instance) { 130 130 throwInvalidAccessError(exec); 131 131 return false; 132 132 } 133 133 134 RefPtr<Instance> instance = m_instance; 135 134 136 instance->begin(); 135 137 … … 170 172 bool RuntimeObjectImp::getOwnPropertyDescriptor(ExecState *exec, const Identifier& propertyName, PropertyDescriptor& descriptor) 171 173 { 172 if (! instance) {174 if (!m_instance) { 173 175 throwInvalidAccessError(exec); 174 176 return false; 175 177 } 176 178 179 RefPtr<Instance> instance = m_instance; 177 180 instance->begin(); 178 181 … … 218 221 void RuntimeObjectImp::put(ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot) 219 222 { 220 if (! instance) {223 if (!m_instance) { 221 224 throwInvalidAccessError(exec); 222 225 return; 223 226 } 224 227 225 RefPtr<Instance> protector(instance);228 RefPtr<Instance> instance = m_instance; 226 229 instance->begin(); 227 230 … … 244 247 JSValue RuntimeObjectImp::defaultValue(ExecState* exec, PreferredPrimitiveType hint) const 245 248 { 246 if (! instance)249 if (!m_instance) 247 250 return throwInvalidAccessError(exec); 248 251 249 RefPtr<Instance> protector(instance); 252 RefPtr<Instance> instance = m_instance; 253 250 254 instance->begin(); 251 255 JSValue result = instance->defaultValue(exec, hint); … … 265 269 CallType RuntimeObjectImp::getCallData(CallData& callData) 266 270 { 267 if (! instance || !instance->supportsInvokeDefaultMethod())271 if (!m_instance) 268 272 return CallTypeNone; 273 274 RefPtr<Instance> instance = m_instance; 275 if (!instance->supportsInvokeDefaultMethod()) 276 return CallTypeNone; 277 269 278 callData.native.function = callRuntimeObject; 270 279 return CallTypeHost; … … 284 293 ConstructType RuntimeObjectImp::getConstructData(ConstructData& constructData) 285 294 { 286 if (! instance || !instance->supportsConstruct())295 if (!m_instance) 287 296 return ConstructTypeNone; 297 298 RefPtr<Instance> instance = m_instance; 299 if (!instance->supportsConstruct()) 300 return ConstructTypeNone; 301 288 302 constructData.native.function = callRuntimeConstructor; 289 303 return ConstructTypeHost; … … 292 306 void RuntimeObjectImp::getPropertyNames(ExecState* exec, PropertyNameArray& propertyNames) 293 307 { 294 if (! instance) {308 if (!m_instance) { 295 309 throwInvalidAccessError(exec); 296 310 return; 297 311 } 298 312 313 RefPtr<Instance> instance = m_instance; 314 299 315 instance->begin(); 300 316 instance->getPropertyNames(exec, propertyNames); -
trunk/WebCore/bridge/runtime_object.h
r48336 r48492 50 50 51 51 virtual void invalidate(); 52 Bindings::Instance* getInternalInstance() const { return instance.get(); }52 Bindings::Instance* getInternalInstance() const { return m_instance.get(); } 53 53 54 54 static JSObject* throwInvalidAccessError(ExecState*); … … 76 76 static JSValue methodGetter(ExecState*, const Identifier&, const PropertySlot&); 77 77 78 RefPtr<Bindings::Instance> instance;78 RefPtr<Bindings::Instance> m_instance; 79 79 }; 80 80 -
trunk/WebKit/mac/ChangeLog
r48471 r48492 1 2009-09-17 Anders Carlsson <andersca@apple.com> 2 3 Reviewed by Oliver Hunt. 4 5 <rdar://problem/7007541> 6 CrashTracer: 4800+ crashes in Safari at com.apple.WebKit • WTF::HashTableIterator... 7 8 Add null checks for m_instanceProxy (It will be null when a plug-in has crashed). 9 10 * Plugins/Hosted/ProxyInstance.mm: 11 (WebKit::ProxyInstance::invoke): 12 (WebKit::ProxyInstance::supportsInvokeDefaultMethod): 13 (WebKit::ProxyInstance::supportsConstruct): 14 (WebKit::ProxyInstance::getPropertyNames): 15 (WebKit::ProxyInstance::methodsNamed): 16 (WebKit::ProxyInstance::fieldNamed): 17 (WebKit::ProxyInstance::fieldValue): 18 (WebKit::ProxyInstance::setFieldValue): 19 (WebKit::ProxyInstance::invalidate): 20 1 21 2009-09-16 Simon Fraser <simon.fraser@apple.com> 2 22 -
trunk/WebKit/mac/Plugins/Hosted/ProxyInstance.mm
r45607 r48492 137 137 JSValue ProxyInstance::invoke(JSC::ExecState* exec, InvokeType type, uint64_t identifier, const JSC::ArgList& args) 138 138 { 139 if (!m_instanceProxy) 140 return jsUndefined(); 141 139 142 RetainPtr<NSData*> arguments(m_instanceProxy->marshalValues(exec, args)); 140 143 … … 163 166 bool ProxyInstance::supportsInvokeDefaultMethod() const 164 167 { 168 if (!m_instanceProxy) 169 return false; 170 165 171 uint32_t requestID = m_instanceProxy->nextRequestID(); 166 172 … … 184 190 bool ProxyInstance::supportsConstruct() const 185 191 { 192 if (!m_instanceProxy) 193 return false; 194 186 195 uint32_t requestID = m_instanceProxy->nextRequestID(); 187 196 … … 237 246 void ProxyInstance::getPropertyNames(ExecState* exec, PropertyNameArray& nameArray) 238 247 { 248 if (!m_instanceProxy) 249 return; 250 239 251 uint32_t requestID = m_instanceProxy->nextRequestID(); 240 252 … … 267 279 MethodList ProxyInstance::methodsNamed(const Identifier& identifier) 268 280 { 281 if (!m_instanceProxy) 282 return MethodList(); 283 269 284 // If we already have an entry in the map, use it. 270 285 MethodMap::iterator existingMapEntry = m_methods.find(identifier.ustring().rep()); … … 304 319 Field* ProxyInstance::fieldNamed(const Identifier& identifier) 305 320 { 321 if (!m_instanceProxy) 322 return 0; 323 306 324 // If we already have an entry in the map, use it. 307 325 FieldMap::iterator existingMapEntry = m_fields.find(identifier.ustring().rep()); … … 333 351 JSC::JSValue ProxyInstance::fieldValue(ExecState* exec, const Field* field) const 334 352 { 353 if (!m_instanceProxy) 354 return jsUndefined(); 355 335 356 uint64_t serverIdentifier = static_cast<const ProxyField*>(field)->serverIdentifier(); 336 357 uint32_t requestID = m_instanceProxy->nextRequestID(); … … 350 371 void ProxyInstance::setFieldValue(ExecState* exec, const Field* field, JSValue value) const 351 372 { 373 if (m_instanceProxy) 374 return; 375 352 376 uint64_t serverIdentifier = static_cast<const ProxyField*>(field)->serverIdentifier(); 353 377 uint32_t requestID = m_instanceProxy->nextRequestID(); … … 369 393 void ProxyInstance::invalidate() 370 394 { 395 ASSERT(m_instanceProxy); 396 371 397 if (NetscapePluginHostProxy* hostProxy = m_instanceProxy->hostProxy()) 372 398 _WKPHNPObjectRelease(hostProxy->port(),
Note: See TracChangeset
for help on using the changeset viewer.