Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: src/GlobalJsObject.cpp

Issue 10259001: XMLHttpRequest API (Closed)
Patch Set: Addressed review comments Created April 11, 2013, 4:30 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/GlobalJsObject.h ('k') | src/JsEngine.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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("_webRequest"), request);
return handleScope.Close(global);
}
« no previous file with comments | « src/GlobalJsObject.h ('k') | src/JsEngine.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld