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

Unified Diff: src/FileSystemJsObject.cpp

Issue 29451722: Issue 4907 - Update v8 to 5.7.278 in libadblockplus (Closed) Base URL: https://github.com/adblockplus/libadblockplus.git
Patch Set: rebase Created June 2, 2017, 7:13 a.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/ConsoleJsObject.cpp ('k') | src/GlobalJsObject.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/FileSystemJsObject.cpp
diff --git a/src/FileSystemJsObject.cpp b/src/FileSystemJsObject.cpp
index 88bff68e4bb65ac71b66e9d18bb38a58d397e75e..e238c3885fb0a19b23e059c4d47ccc5b397cd113 100644
--- a/src/FileSystemJsObject.cpp
+++ b/src/FileSystemJsObject.cpp
@@ -27,6 +27,7 @@
#include "Utils.h"
using namespace AdblockPlus;
+using AdblockPlus::Utils::ThrowExceptionInJS;
namespace
{
@@ -241,111 +242,93 @@ namespace
std::string path;
};
- v8::Handle<v8::Value> ReadCallback(const v8::Arguments& arguments)
+ void ReadCallback(const v8::FunctionCallbackInfo<v8::Value>& arguments)
{
AdblockPlus::JsEnginePtr jsEngine = AdblockPlus::JsEngine::FromArguments(arguments);
AdblockPlus::JsValueList converted = jsEngine->ConvertArguments(arguments);
v8::Isolate* isolate = arguments.GetIsolate();
if (converted.size() != 2)
- return v8::ThrowException(Utils::ToV8String(isolate,
- "_fileSystem.read requires 2 parameters"));
+ return ThrowExceptionInJS(isolate, "_fileSystem.read requires 2 parameters");
if (!converted[1].IsFunction())
- return v8::ThrowException(Utils::ToV8String(isolate,
- "Second argument to _fileSystem.read must be a function"));
+ return ThrowExceptionInJS(isolate, "Second argument to _fileSystem.read must be a function");
ReadThread* const readThread = new ReadThread(jsEngine, converted[1],
converted[0].AsString());
readThread->Start();
- return v8::Undefined();
}
- v8::Handle<v8::Value> WriteCallback(const v8::Arguments& arguments)
+ void WriteCallback(const v8::FunctionCallbackInfo<v8::Value>& arguments)
{
AdblockPlus::JsEnginePtr jsEngine = AdblockPlus::JsEngine::FromArguments(arguments);
AdblockPlus::JsValueList converted = jsEngine->ConvertArguments(arguments);
v8::Isolate* isolate = arguments.GetIsolate();
if (converted.size() != 3)
- return v8::ThrowException(Utils::ToV8String(isolate,
- "_fileSystem.write requires 3 parameters"));
+ return ThrowExceptionInJS(isolate, "_fileSystem.write requires 3 parameters");
if (!converted[2].IsFunction())
- return v8::ThrowException(Utils::ToV8String(isolate,
- "Third argument to _fileSystem.write must be a function"));
+ return ThrowExceptionInJS(isolate, "Third argument to _fileSystem.write must be a function");
WriteThread* const writeThread = new WriteThread(jsEngine, converted[2],
converted[0].AsString(), converted[1].AsString());
writeThread->Start();
- return v8::Undefined();
}
- v8::Handle<v8::Value> MoveCallback(const v8::Arguments& arguments)
+ void MoveCallback(const v8::FunctionCallbackInfo<v8::Value>& arguments)
{
AdblockPlus::JsEnginePtr jsEngine = AdblockPlus::JsEngine::FromArguments(arguments);
AdblockPlus::JsValueList converted = jsEngine->ConvertArguments(arguments);
v8::Isolate* isolate = arguments.GetIsolate();
if (converted.size() != 3)
- return v8::ThrowException(Utils::ToV8String(isolate,
- "_fileSystem.move requires 3 parameters"));
+ return ThrowExceptionInJS(isolate, "_fileSystem.move requires 3 parameters");
if (!converted[2].IsFunction())
- return v8::ThrowException(Utils::ToV8String(isolate,
- "Third argument to _fileSystem.move must be a function"));
+ return ThrowExceptionInJS(isolate, "Third argument to _fileSystem.move must be a function");
MoveThread* const moveThread = new MoveThread(jsEngine, converted[2],
converted[0].AsString(), converted[1].AsString());
moveThread->Start();
- return v8::Undefined();
}
- v8::Handle<v8::Value> RemoveCallback(const v8::Arguments& arguments)
+ void RemoveCallback(const v8::FunctionCallbackInfo<v8::Value>& arguments)
{
AdblockPlus::JsEnginePtr jsEngine = AdblockPlus::JsEngine::FromArguments(arguments);
AdblockPlus::JsValueList converted = jsEngine->ConvertArguments(arguments);
v8::Isolate* isolate = arguments.GetIsolate();
if (converted.size() != 2)
- return v8::ThrowException(Utils::ToV8String(isolate,
- "_fileSystem.remove requires 2 parameters"));
+ return ThrowExceptionInJS(isolate, "_fileSystem.remove requires 2 parameters");
if (!converted[1].IsFunction())
- return v8::ThrowException(Utils::ToV8String(isolate,
- "Second argument to _fileSystem.remove must be a function"));
+ return ThrowExceptionInJS(isolate, "Second argument to _fileSystem.remove must be a function");
RemoveThread* const removeThread = new RemoveThread(jsEngine, converted[1],
converted[0].AsString());
removeThread->Start();
- return v8::Undefined();
}
- v8::Handle<v8::Value> StatCallback(const v8::Arguments& arguments)
+ void StatCallback(const v8::FunctionCallbackInfo<v8::Value>& arguments)
{
AdblockPlus::JsEnginePtr jsEngine = AdblockPlus::JsEngine::FromArguments(arguments);
AdblockPlus::JsValueList converted = jsEngine->ConvertArguments(arguments);
v8::Isolate* isolate = arguments.GetIsolate();
if (converted.size() != 2)
- return v8::ThrowException(Utils::ToV8String(isolate,
- "_fileSystem.stat requires 2 parameters"));
+ return ThrowExceptionInJS(isolate, "_fileSystem.stat requires 2 parameters");
if (!converted[1].IsFunction())
- return v8::ThrowException(Utils::ToV8String(isolate,
- "Second argument to _fileSystem.stat must be a function"));
+ return ThrowExceptionInJS(isolate, "Second argument to _fileSystem.stat must be a function");
StatThread* const statThread = new StatThread(jsEngine, converted[1],
converted[0].AsString());
statThread->Start();
- return v8::Undefined();
}
- v8::Handle<v8::Value> ResolveCallback(const v8::Arguments& arguments)
+ void ResolveCallback(const v8::FunctionCallbackInfo<v8::Value>& arguments)
{
AdblockPlus::JsEnginePtr jsEngine = AdblockPlus::JsEngine::FromArguments(arguments);
AdblockPlus::JsValueList converted = jsEngine->ConvertArguments(arguments);
v8::Isolate* isolate = arguments.GetIsolate();
if (converted.size() != 1)
- return v8::ThrowException(Utils::ToV8String(isolate,
- "_fileSystem.resolve requires 1 parameter"));
+ return ThrowExceptionInJS(isolate, "_fileSystem.resolve requires 1 parameter");
std::string resolved = jsEngine->GetFileSystem()->Resolve(converted[0].AsString());
-
- return Utils::ToV8String(isolate, resolved);
+ arguments.GetReturnValue().Set(Utils::ToV8String(isolate, resolved));
}
-
}
« no previous file with comments | « src/ConsoleJsObject.cpp ('k') | src/GlobalJsObject.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld