I have a CefV8Handler object that I call from JS and pass in a callback function. The handler does some work and responds asynchronously by calling ExecuteFunction on that callback object. (Note: this is called outside the scope of Execute or HandleJSBinding).
I crash if try to change document.location or an exception occurs during in the callback.
firstwindow calls v8::Context::GetEntered() which returns a null pointer for the context. Is there a way to ensure this gets set when I callback into JS?
Here is the call stack at the point of the crash:
> libcef.dll!v8::internal::Handle<v8::internal::Object>::operator*() Line 49 + 0x5 bytes C++
libcef.dll!v8::internal::Handle<v8::internal::Context>::cast<v8::internal::Object>(v8::internal::Handle<v8::internal::Object> that={...}) Line 80 + 0x8 bytes C++
libcef.dll!v8::Context::Global() Line 3489 + 0x18 bytes C++
libcef.dll!WebCore::V8Proxy::retrieveWindow(v8::Handle<v8::Context> context={...}) Line 530 + 0x13 bytes C++
libcef.dll!WebCore::State<WebCore::V8Binding>::firstWindow() Line 60 + 0x1a bytes C++
libcef.dll!WebCore::V8DOMWindowShell::setLocation(WebCore::DOMWindow * window=0x0033b4e8, const WTF::String & locationString={...}) Line 594 + 0xa bytes C++
libcef.dll!WebCore::V8Document::locationAccessorSetter(v8::Local<v8::String> name={...}, v8::Local<v8::Value> value={...}, const v8::AccessorInfo & info={...}) Line 53 + 0x20 bytes C++
libcef.dll!v8::internal::JSObject::SetPropertyWithCallback(v8::internal::Object * structure=0x02f94b99, v8::internal::String * name=0x02b9ac4d, v8::internal::Object * value=0x0704abb5, v8::internal::JSObject * holder=0x0703e3d1) Line 1640 + 0x35 bytes C++
libcef.dll!v8::internal::JSObject::SetProperty(v8::internal::LookupResult * result=0x0023e500, v8::internal::String * name=0x02b9ac4d, v8::internal::Object * value=0x0704abb5, PropertyAttributes attributes=NONE) Line 1948 + 0x22 bytes C++
libcef.dll!v8::internal::JSObject::SetProperty(v8::internal::String * name=0x02b9ac4d, v8::internal::Object * value=0x0704abb5, PropertyAttributes attributes=NONE) Line 1599 C++
libcef.dll!v8::internal::StoreIC::Store(v8::internal::InlineCacheState state=UNINITIALIZED, v8::internal::Handle<v8::internal::Object> object={...}, v8::internal::Handle<v8::internal::String> name={...}, v8::internal::Handle<v8::internal::Object> value={...}) Line 1392 C++
libcef.dll!v8::internal::StoreIC_Miss(v8::internal::Arguments args={...}) Line 1710 + 0x3f bytes C++
24bf028e()
libcef.dll!v8::internal::Invoke(bool construct=false, v8::internal::Handle<v8::internal::JSFunction> func={...}, v8::internal::Handle<v8::internal::Object> receiver={...}, int argc=3, v8::internal::Object * * * args=0x00351360, bool * has_pending_exception=0x0023e7cf) Line 97 + 0x19 bytes C++
libcef.dll!v8::internal::Execution::Call(v8::internal::Handle<v8::internal::JSFunction> func={...}, v8::internal::Handle<v8::internal::Object> receiver={...}, int argc=3, v8::internal::Object * * * args=0x00351360, bool * pending_exception=0x0023e7cf) Line 123 + 0x1f bytes C++
libcef.dll!v8::Function::Call(v8::Handle<v8::Object> recv={...}, int argc=3, v8::Handle<v8::Value> * argv=0x00351360) Line 2901 + 0x1d bytes C++
libcef.dll!CefV8ValueImpl::ExecuteFunction(CefRefPtr<CefV8Value> object={...}, const std::vector<CefRefPtr<CefV8Value>,std::allocator<CefRefPtr<CefV8Value> > > & arguments=[3]({ptr_=0x003c8390 },{ptr_=0x06636b28 },{ptr_=0x00351290 }), CefRefPtr<CefV8Value> & retval={...}, CefStringBase<CefStringTraitsUTF16> & exception={...}) Line 686 C++
libcef.dll!v8value_execute_function(_cef_v8value_t * self=0x003c402c, _cef_v8value_t * object=0x066374e4, unsigned int argumentCount=3, _cef_v8value_t * const * arguments=0x00283520, _cef_v8value_t * * retval=0x0023eb00, _cef_string_utf16_t * exception=0x00282e40) Line 390 + 0x4b bytes C++
1. What am I doing wrong?
2. What is the proper "object" I should pass in to the ExecuteFunction call? I tried using the object I got from the HandleJSBinding call and just an empty object I created at the time I was in the Execute callback and both had the same results.