Left: | ||
Right: |
LEFT | RIGHT |
---|---|
1 #include <vector> | 1 #include <vector> |
2 #include <stdexcept> | 2 #include <stdexcept> |
3 | 3 |
4 #include <AdblockPlus/JsEngine.h> | 4 #include <AdblockPlus/JsEngine.h> |
5 #include <AdblockPlus/JsValue.h> | 5 #include <AdblockPlus/JsValue.h> |
6 | |
7 #include "AppInfoJsObject.h" | |
6 #include "ConsoleJsObject.h" | 8 #include "ConsoleJsObject.h" |
7 #include "FileSystemJsObject.h" | 9 #include "FileSystemJsObject.h" |
8 #include "GlobalJsObject.h" | 10 #include "GlobalJsObject.h" |
9 #include "ConsoleJsObject.h" | 11 #include "ConsoleJsObject.h" |
10 #include "WebRequestJsObject.h" | 12 #include "WebRequestJsObject.h" |
11 #include "Thread.h" | 13 #include "Thread.h" |
12 | 14 |
13 using namespace AdblockPlus; | 15 using namespace AdblockPlus; |
14 | 16 |
15 namespace | 17 namespace |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
61 } | 63 } |
62 timeoutThread->Start(); | 64 timeoutThread->Start(); |
63 | 65 |
64 // We should actually return the timer ID here, which could be | 66 // We should actually return the timer ID here, which could be |
65 // used via clearTimeout(). But since we don't seem to need | 67 // used via clearTimeout(). But since we don't seem to need |
66 // clearTimeout(), we can save that for later. | 68 // clearTimeout(), we can save that for later. |
67 return v8::Undefined(); | 69 return v8::Undefined(); |
68 } | 70 } |
69 } | 71 } |
70 | 72 |
71 JsValuePtr GlobalJsObject::Setup(JsEngine& jsEngine, JsValuePtr obj) | 73 JsValuePtr GlobalJsObject::Setup(JsEngine& jsEngine, const AppInfo& appInfo, |
74 JsValuePtr obj) | |
72 { | 75 { |
73 obj->SetProperty("setTimeout", jsEngine.NewCallback(::SetTimeoutCallback)); | 76 obj->SetProperty("setTimeout", jsEngine.NewCallback(::SetTimeoutCallback)); |
74 obj->SetProperty("_fileSystem", | 77 obj->SetProperty("_fileSystem", |
75 FileSystemJsObject::Setup(jsEngine, jsEngine.NewObject())); | 78 FileSystemJsObject::Setup(jsEngine, jsEngine.NewObject())); |
Felix Dahlke
2013/04/18 12:46:50
Why pass a new object in? Seems to make more sense
Wladimir Palant
2013/04/18 13:29:33
Merely for consistency. GlobaJsObject::Setup() can
| |
76 obj->SetProperty("_webRequest", | 79 obj->SetProperty("_webRequest", |
77 WebRequestJsObject::Setup(jsEngine, jsEngine.NewObject())); | 80 WebRequestJsObject::Setup(jsEngine, jsEngine.NewObject())); |
78 obj->SetProperty("console", | 81 obj->SetProperty("console", |
79 ConsoleJsObject::Setup(jsEngine, jsEngine.NewObject())); | 82 ConsoleJsObject::Setup(jsEngine, jsEngine.NewObject())); |
83 obj->SetProperty("_appInfo", | |
84 AppInfoJsObject::Setup(jsEngine, appInfo, jsEngine.NewObject())); | |
80 return obj; | 85 return obj; |
81 } | 86 } |
LEFT | RIGHT |