RESOLVED FIXED 107020
[V8] Make a creationContext parameter of toV8() mandatory
https://bugs.webkit.org/show_bug.cgi?id=107020
Summary [V8] Make a creationContext parameter of toV8() mandatory
Kentaro Hara
Reported 2013-01-16 08:51:15 PST
Currently a creationContext parameter of toV8() is optional: Handle<Value> toV8(..., Handle<Object> creationContext = Handle<Object>(), ...) { ...; } On the other hand, looking at the implementation of V8WrapperInstantiationScope: explicit V8WrapperInstantiationScope(v8::Handle<v8::Object> creationContext) : m_didEnterContext(false) , m_context(v8::Context::GetCurrent()) { if (creationContext.IsEmpty()) // We do nothing for this case! return; v8::Handle<v8::Context> contextForWrapper = creationContext->CreationContext(); if (contextForWrapper == m_context) return; m_context = v8::Local<v8::Context>::New(contextForWrapper); m_didEnterContext = true; m_context->Enter(); } we're assuming that a creationContext parameter is passed to toV8() when a creationContext exists. In other words, if we forget to pass a creationContext parameter, we will end up with creating an object on the current context, which is wrong. To avoid the mistake, we should make the creationContext parameter mandatory. When we really do not have a creationContext, we can pass Handle<Object>() explicitly.
Attachments
Patch (43.43 KB, patch)
2013-01-16 08:55 PST, Kentaro Hara
no flags
Kentaro Hara
Comment 1 2013-01-16 08:55:51 PST
Adam Barth
Comment 2 2013-01-16 10:59:38 PST
Comment on attachment 182993 [details] Patch Yeah, we should really pass non-empty handles in all these places.
WebKit Review Bot
Comment 3 2013-01-16 11:23:06 PST
Comment on attachment 182993 [details] Patch Clearing flags on attachment: 182993 Committed r139900: <http://trac.webkit.org/changeset/139900>
WebKit Review Bot
Comment 4 2013-01-16 11:23:10 PST
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.