On Mon, Aug 19, 2013 at 11:21 PM, Clemens Cap <[email protected]> wrote: > Why would I then get a "Cannot exit non-entered context" in the following > code fragment? > > Context::GetEntered()->Exit(); > > I get the same error in > > Context::GetCurrent()->Exit();
Check if the return value from Context::GetEntered() and Context::GetCurrent() is actually a valid handle. I suspect that you'll find that handle.IsEmpty() == true, meaning you haven't entered a context > What I am trying to achieve is the following: I want to execute a Javascript > function in a V8 Container. Then, later, I want to execute another > Javascript function in a "fresh" Container without having to repeat all the > initialization. "Fresh" means that there should be no influence from the > former execution on the latter. Currently I start an Isolate, generate a > context using a persistent object template to add some C++ functions. Then I > run some Javascript to make some additional functions known to the global > object - and THEN I execute my Javascript function. What is now the fastest > way to a "fresh" "situation" with > the same initializations (C++ and Javascript)? > > I tried exiting the current content and generating a fresh one ... and > that's where I ran into the above problem. It depends on how secure it needs to be. If you're running trusted code, your approach seems okay. Creating a new Context is probably easier than trying to clean up the current one, though (if that's what you're trying to do.) If you're running untrusted code, it sounds like it could "escape", e.g. by walking the prototype chain of a global object or function. -- -- v8-users mailing list [email protected] http://groups.google.com/group/v8-users --- You received this message because you are subscribed to the Google Groups "v8-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
