| OLD | NEW |
| 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 v8::Handle<v8::ObjectTemplate> GlobalJsObject::Create( | 73 v8::Handle<v8::ObjectTemplate> GlobalJsObject::Create( |
| 72 JsEngine& jsEngine) | 74 const AppInfo& appInfo, JsEngine& jsEngine) |
| 73 { | 75 { |
| 74 const v8::Locker locker(v8::Isolate::GetCurrent()); | 76 const v8::Locker locker(v8::Isolate::GetCurrent()); |
| 75 v8::HandleScope handleScope; | 77 v8::HandleScope handleScope; |
| 76 const v8::Handle<v8::ObjectTemplate> global = v8::ObjectTemplate::New(); | 78 const v8::Handle<v8::ObjectTemplate> global = v8::ObjectTemplate::New(); |
| 77 const v8::Handle<v8::FunctionTemplate> setTimeoutFunction = | 79 const v8::Handle<v8::FunctionTemplate> setTimeoutFunction = |
| 78 v8::FunctionTemplate::New(SetTimeoutCallback, | 80 v8::FunctionTemplate::New(SetTimeoutCallback, |
| 79 v8::External::New(&jsEngine)); | 81 v8::External::New(&jsEngine)); |
| 80 global->Set(v8::String::New("setTimeout"), setTimeoutFunction); | 82 global->Set(v8::String::New("setTimeout"), setTimeoutFunction); |
| 81 const v8::Handle<v8::ObjectTemplate> fileSystemObject = | 83 const v8::Handle<v8::ObjectTemplate> fileSystemObject = |
| 82 FileSystemJsObject::Create(jsEngine); | 84 FileSystemJsObject::Create(jsEngine); |
| 83 global->Set(v8::String::New("_fileSystem"), fileSystemObject); | 85 global->Set(v8::String::New("_fileSystem"), fileSystemObject); |
| 84 const v8::Handle<v8::ObjectTemplate> webRequestObject = | 86 const v8::Handle<v8::ObjectTemplate> webRequestObject = |
| 85 WebRequestJsObject::Create(jsEngine); | 87 WebRequestJsObject::Create(jsEngine); |
| 86 global->Set(v8::String::New("_webRequest"), webRequestObject); | 88 global->Set(v8::String::New("_webRequest"), webRequestObject); |
| 87 const v8::Handle<v8::ObjectTemplate> consoleObject = | 89 const v8::Handle<v8::ObjectTemplate> consoleObject = |
| 88 ConsoleJsObject::Create(jsEngine); | 90 ConsoleJsObject::Create(jsEngine); |
| 89 global->Set(v8::String::New("console"), consoleObject); | 91 global->Set(v8::String::New("console"), consoleObject); |
| 92 const v8::Handle<v8::ObjectTemplate> appInfoObject = |
| 93 AppInfoJsObject::Create(appInfo); |
| 94 global->Set(v8::String::New("_appInfo"), appInfoObject); |
| 90 return handleScope.Close(global); | 95 return handleScope.Close(global); |
| 91 } | 96 } |
| OLD | NEW |