Index: src/JsEngine.cpp |
=================================================================== |
--- a/src/JsEngine.cpp |
+++ b/src/JsEngine.cpp |
@@ -109,6 +109,19 @@ |
return *ascii; |
} |
+std::string AdblockPlus::JsEngine::GetGlobal(const std::string& name) |
Wladimir Palant
2013/04/08 08:36:00
This name got me thoroughly confused. Please renam
Felix Dahlke
2013/04/08 13:07:49
Sure. Called it "GetVariable" since I think that "
|
+{ |
+ const v8::Locker locker(v8::Isolate::GetCurrent()); |
+ const v8::HandleScope handleScope; |
+ const v8::Context::Scope contextScope(context); |
+ const v8::Local<v8::Object> global = context->Global(); |
+ const v8::Local<v8::Value> value = global->Get(v8::String::New(name.c_str())); |
+ if (value->IsUndefined()) |
+ return ""; |
+ const v8::String::AsciiValue ascii(value); |
+ return *ascii; |
+} |
+ |
void AdblockPlus::JsEngine::Gc() |
{ |
while (!v8::V8::IdleNotification()); |