Hi guys,
I have just recently started playing around with v8.
I created this little app that can take javascript strings per request
from the user.
I have an API with some functions they can use and I preload a
javascript file that adds to this API.
What I would like to know is how to keep the context I made clean
through each run of the users javascript strings.
Here's a little pseudo code I hope will illustrate what I want.
ObjectTable global
global->Set('rawprint',CPP_Print_FUNC);
Context cntx = new(Null,global)
load('additional_api_functions.js); // contains print = function(m)
{rawprint(m)};
User1 = "oprint = print; print = function(m) { oprint('This is a
'+m); }; print('test');";
User1->Run(); // This outputs "This is a test"
User2 = "print('test');';
User2->Run(); // This also outputs "This is a test", but I would like
it only to output "test"
I am guessing I have to wrap each User request in its own context.
But how can I make this User context inherit the global context in
such a way that they can
modify or even remove parts of the API without these changes effecting
the next user's request.
I really hope I could make myself clear and I thank you in advance for
any help you can give.
--
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users