| OLD | NEW |
| 1 #include <map> | 1 #include <map> |
| 2 #include <AdblockPlus/JsEngine.h> | 2 #include <AdblockPlus/JsEngine.h> |
| 3 #include <AdblockPlus/JsValue.h> | 3 #include <AdblockPlus/JsValue.h> |
| 4 #include <AdblockPlus/WebRequest.h> | 4 #include <AdblockPlus/WebRequest.h> |
| 5 #include "WebRequestJsObject.h" | 5 #include "WebRequestJsObject.h" |
| 6 #include "Thread.h" | 6 #include "Thread.h" |
| 7 | 7 |
| 8 namespace | 8 namespace |
| 9 { | 9 { |
| 10 class WebRequestThread : public AdblockPlus::Thread | 10 class WebRequestThread : public AdblockPlus::Thread |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 } | 82 } |
| 83 catch (const std::exception& e) | 83 catch (const std::exception& e) |
| 84 { | 84 { |
| 85 return v8::ThrowException(v8::String::New(e.what())); | 85 return v8::ThrowException(v8::String::New(e.what())); |
| 86 } | 86 } |
| 87 thread->Start(); | 87 thread->Start(); |
| 88 return v8::Undefined(); | 88 return v8::Undefined(); |
| 89 } | 89 } |
| 90 } | 90 } |
| 91 | 91 |
| 92 v8::Handle<v8::ObjectTemplate> AdblockPlus::WebRequestJsObject::Create( | 92 AdblockPlus::JsValuePtr AdblockPlus::WebRequestJsObject::Setup( |
| 93 AdblockPlus::JsEngine& jsEngine) | 93 AdblockPlus::JsEngine& jsEngine, AdblockPlus::JsValuePtr obj) |
| 94 { | 94 { |
| 95 v8::HandleScope handleScope; | 95 obj->SetProperty("GET", jsEngine.NewCallback(::GETCallback)); |
| 96 const v8::Handle<v8::ObjectTemplate> request = v8::ObjectTemplate::New(); | 96 return obj; |
| 97 const v8::Handle<v8::FunctionTemplate> getFunction = | |
| 98 v8::FunctionTemplate::New(::GETCallback, | |
| 99 v8::External::New(&jsEngine)); | |
| 100 request->Set(v8::String::New("GET"), getFunction); | |
| 101 return handleScope.Close(request); | |
| 102 } | 97 } |
| OLD | NEW |