Changeset 51312 in webkit
- Timestamp:
- Nov 23, 2009 11:12:08 AM (14 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r51310 r51312 1 2009-11-23 Adam Barth <abarth@webkit.org> 2 3 Reviewed by Dimitri Glazkov. 4 5 [V8] Don't crash when OOM in creating isolated world 6 https://bugs.webkit.org/show_bug.cgi?id=31805 7 8 We need to add some more null checks to avoid crashing. No new tests 9 because we don't have a good way to test out-of-memory bugs. 10 11 * bindings/v8/V8Proxy.cpp: 12 (WebCore::V8Proxy::evaluateInIsolatedWorld): 13 (WebCore::V8Proxy::evaluateInNewContext): 14 (WebCore::V8Proxy::setInjectedScriptContextDebugId): 15 * bindings/v8/V8Proxy.h: 16 1 17 2009-11-23 Dirk Schulze <krit@webkit.org> 2 18 -
trunk/WebCore/bindings/v8/V8Proxy.cpp
r50993 r51312 312 312 313 313 // Setup context id for JS debugger. 314 setInjectedScriptContextDebugId(world->context()); 314 if (!setInjectedScriptContextDebugId(world->context())) { 315 m_isolatedWorlds.take(worldID); 316 delete world; 317 return; 318 } 315 319 } 316 320 } else { … … 351 355 352 356 // Setup context id for JS debugger. 353 setInjectedScriptContextDebugId(context); 357 if (!setInjectedScriptContextDebugId(context)) { 358 context.Dispose(); 359 return; 360 } 354 361 355 362 v8::Handle<v8::Object> global = context->Global(); … … 377 384 } 378 385 379 voidV8Proxy::setInjectedScriptContextDebugId(v8::Handle<v8::Context> targetContext)386 bool V8Proxy::setInjectedScriptContextDebugId(v8::Handle<v8::Context> targetContext) 380 387 { 381 388 // Setup context id for JS debugger. 382 389 v8::Context::Scope contextScope(targetContext); 383 390 v8::Handle<v8::Object> contextData = v8::Object::New(); 384 391 if (contextData.IsEmpty()) 392 return false; 393 394 if (m_context.IsEmpty()) 395 return false; 385 396 v8::Handle<v8::Value> windowContextData = m_context->GetData(); 386 397 if (windowContextData->IsObject()) { 387 398 v8::Handle<v8::String> propertyName = v8::String::New(kContextDebugDataValue); 399 if (propertyName.IsEmpty()) 400 return false; 388 401 contextData->Set(propertyName, v8::Object::Cast(*windowContextData)->Get(propertyName)); 389 402 } 390 contextData->Set(v8::String::New(kContextDebugDataType), v8::String::New("injected")); 403 v8::Handle<v8::String> propertyName = v8::String::New(kContextDebugDataType); 404 if (propertyName.IsEmpty()) 405 return false; 406 contextData->Set(propertyName, v8::String::New("injected")); 391 407 targetContext->SetData(contextData); 408 return true; 392 409 } 393 410 -
trunk/WebCore/bindings/v8/V8Proxy.h
r50958 r51312 388 388 void resetIsolatedWorlds(); 389 389 390 void setInjectedScriptContextDebugId(v8::Handle<v8::Context> targetContext); 390 // Returns false when we're out of memory in V8. 391 bool setInjectedScriptContextDebugId(v8::Handle<v8::Context> targetContext); 391 392 392 393 static bool canAccessPrivate(DOMWindow*);
Note: See TracChangeset
for help on using the changeset viewer.