#include "globals.h" #include "V8Script.h" #include "utf8_helpers.h" using namespace v8; V8Script::V8Script() : exceptionCallback(NULL), exceptionCallbackParam(NULL) { } V8Script::~V8Script() { dispose(); } bool V8Script::compile(const TCHAR *source, Dialog *dlg) { dispose(); HandleScope handle_scope; context = Context::New(); Context::Scope context_scope(context); context->Global()->Set(String::New("window"), wrappers.createDialogWrapper(), ReadOnly); context->Global()->Set(String::New("opts"), wrappers.createOptionsWrapper(), ReadOnly); for(unsigned int i = 0; i < dlg->fields.size(); i++) { Field *field = dlg->fields[i]; context->Global()->Set(String::New(field->getName()), wrappers.createWrapper(field->getType()), ReadOnly); } wrappers.clearTemplates(); TryCatch try_catch; Local