Index: src/GlobalJsObject.cpp |
=================================================================== |
--- a/src/GlobalJsObject.cpp |
+++ b/src/GlobalJsObject.cpp |
@@ -1,12 +1,14 @@ |
#include <vector> |
#include <stdexcept> |
#include "GlobalJsObject.h" |
+#include "ConsoleJsObject.h" |
+#include "WebRequestJsObject.h" |
#include "Thread.h" |
using namespace AdblockPlus; |
namespace |
{ |
class TimeoutThread : public Thread |
{ |
@@ -81,21 +83,24 @@ namespace |
// We should actually return the timer ID here, which could be |
// used via clearTimeout(). But since we don't seem to need |
// clearTimeout(), we can save that for later. |
return v8::Undefined(); |
} |
} |
v8::Handle<v8::ObjectTemplate> GlobalJsObject::Create( |
- ErrorCallback& errorCallback) |
+ ErrorCallback& errorCallback, WebRequest& webRequest) |
{ |
const v8::Locker locker(v8::Isolate::GetCurrent()); |
v8::HandleScope handleScope; |
const v8::Handle<v8::ObjectTemplate> global = v8::ObjectTemplate::New(); |
const v8::Handle<v8::ObjectTemplate> console = |
AdblockPlus::ConsoleJsObject::Create(errorCallback); |
global->Set(v8::String::New("console"), console); |
const v8::Handle<v8::FunctionTemplate> setTimeoutFunction = |
v8::FunctionTemplate::New(SetTimeoutCallback); |
global->Set(v8::String::New("setTimeout"), setTimeoutFunction); |
+ const v8::Handle<v8::ObjectTemplate> request = |
+ AdblockPlus::WebRequestJsObject::Create(webRequest); |
+ global->Set(v8::String::New("_request"), request); |
Felix Dahlke
2013/04/11 09:33:42
I'd prefer _webRequest for consistency.
|
return handleScope.Close(global); |
} |