X-Git-Url: https://git.webkit.org/?p=WebKit-https.git;a=blobdiff_plain;f=WebCore%2Fbindings%2Fv8%2FV8Proxy.cpp;h=89a8b57f07056c6c622a624d710aaa8b35e37ed8;hp=6969185d9b9258cf526f646058233e41b6ce26d7;hb=634974b86a70fcf62ff3d122f359b99981c92353;hpb=1a9e72cf64edd0a5eb714fe1ac8ec1fe0ac74a39;ds=sidebyside diff --git a/WebCore/bindings/v8/V8Proxy.cpp b/WebCore/bindings/v8/V8Proxy.cpp index 6969185d9b92..89a8b57f0705 100644 --- a/WebCore/bindings/v8/V8Proxy.cpp +++ b/WebCore/bindings/v8/V8Proxy.cpp @@ -311,7 +311,11 @@ void V8Proxy::evaluateInIsolatedWorld(int worldID, const Vectorcontext()); + if (!setInjectedScriptContextDebugId(world->context())) { + m_isolatedWorlds.take(worldID); + delete world; + return; + } } } else { world = new V8IsolatedWorld(this, extensionGroup); @@ -350,7 +354,10 @@ void V8Proxy::evaluateInNewContext(const Vector& sources, int v8::Context::Scope contextScope(context); // Setup context id for JS debugger. - setInjectedScriptContextDebugId(context); + if (!setInjectedScriptContextDebugId(context)) { + context.Dispose(); + return; + } v8::Handle global = context->Global(); @@ -376,19 +383,29 @@ void V8Proxy::evaluateInNewContext(const Vector& sources, int context.Dispose(); } -void V8Proxy::setInjectedScriptContextDebugId(v8::Handle targetContext) +bool V8Proxy::setInjectedScriptContextDebugId(v8::Handle targetContext) { // Setup context id for JS debugger. v8::Context::Scope contextScope(targetContext); v8::Handle contextData = v8::Object::New(); + if (contextData.IsEmpty()) + return false; + if (m_context.IsEmpty()) + return false; v8::Handle windowContextData = m_context->GetData(); if (windowContextData->IsObject()) { v8::Handle propertyName = v8::String::New(kContextDebugDataValue); + if (propertyName.IsEmpty()) + return false; contextData->Set(propertyName, v8::Object::Cast(*windowContextData)->Get(propertyName)); } - contextData->Set(v8::String::New(kContextDebugDataType), v8::String::New("injected")); + v8::Handle propertyName = v8::String::New(kContextDebugDataType); + if (propertyName.IsEmpty()) + return false; + contextData->Set(propertyName, v8::String::New("injected")); targetContext->SetData(contextData); + return true; } v8::Local V8Proxy::evaluate(const ScriptSourceCode& source, Node* node)