Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: src/JsEngine.cpp

Issue 10085006: Implement setTimeout (Closed)
Patch Set: Created April 5, 2013, 3:49 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
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());

Powered by Google App Engine
This is Rietveld