Left: | ||
Right: |
OLD | NEW |
---|---|
1 #include <vector> | 1 #include <vector> |
2 #include <stdexcept> | 2 #include <stdexcept> |
3 | 3 |
4 #include "GlobalJsObject.h" | 4 #include "GlobalJsObject.h" |
5 #include "Thread.h" | 5 #include "Thread.h" |
6 | 6 |
7 using namespace AdblockPlus; | 7 using namespace AdblockPlus; |
8 | 8 |
9 namespace | 9 namespace |
10 { | 10 { |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
43 for (Values::iterator it = functionArguments.begin(); | 43 for (Values::iterator it = functionArguments.begin(); |
44 it != functionArguments.end(); it++) | 44 it != functionArguments.end(); it++) |
45 it->Dispose(isolate); | 45 it->Dispose(isolate); |
46 } | 46 } |
47 | 47 |
48 void Run() | 48 void Run() |
49 { | 49 { |
50 Sleep(delay); | 50 Sleep(delay); |
51 const v8::Locker locker(isolate); | 51 const v8::Locker locker(isolate); |
52 const v8::HandleScope handleScope; | 52 const v8::HandleScope handleScope; |
53 function->Call(function, functionArguments.size(), &functionArguments[0]); | 53 v8::Handle<v8::Value> argv = functionArguments.size() > 0 ? functionArgume nts[0] : v8::Handle<v8::Value>(); |
54 function->Call(function, functionArguments.size(), &argv); | |
Wladimir Palant
2013/04/09 05:47:07
No, this isn't right. You *copy* the first argumen
Oleksandr
2013/04/09 05:54:21
Ah. You're right. My bad.
It's not that I *wante
Felix Dahlke
2013/04/09 08:18:06
Ah, just saw the original change here, didn't show
| |
54 delete this; | 55 delete this; |
55 } | 56 } |
56 | 57 |
57 private: | 58 private: |
58 typedef v8::Persistent<v8::Value> Value; | 59 typedef v8::Persistent<v8::Value> Value; |
59 typedef std::vector<Value> Values; | 60 typedef std::vector<Value> Values; |
60 | 61 |
61 v8::Isolate* const isolate; | 62 v8::Isolate* const isolate; |
62 v8::Persistent<v8::Function> function; | 63 v8::Persistent<v8::Function> function; |
63 int delay; | 64 int delay; |
(...skipping 27 matching lines...) Expand all Loading... | |
91 v8::HandleScope handleScope; | 92 v8::HandleScope handleScope; |
92 const v8::Handle<v8::ObjectTemplate> global = v8::ObjectTemplate::New(); | 93 const v8::Handle<v8::ObjectTemplate> global = v8::ObjectTemplate::New(); |
93 const v8::Handle<v8::ObjectTemplate> console = | 94 const v8::Handle<v8::ObjectTemplate> console = |
94 AdblockPlus::ConsoleJsObject::Create(errorCallback); | 95 AdblockPlus::ConsoleJsObject::Create(errorCallback); |
95 global->Set(v8::String::New("console"), console); | 96 global->Set(v8::String::New("console"), console); |
96 const v8::Handle<v8::FunctionTemplate> setTimeoutFunction = | 97 const v8::Handle<v8::FunctionTemplate> setTimeoutFunction = |
97 v8::FunctionTemplate::New(SetTimeoutCallback); | 98 v8::FunctionTemplate::New(SetTimeoutCallback); |
98 global->Set(v8::String::New("setTimeout"), setTimeoutFunction); | 99 global->Set(v8::String::New("setTimeout"), setTimeoutFunction); |
99 return handleScope.Close(global); | 100 return handleScope.Close(global); |
100 } | 101 } |
OLD | NEW |