Index: src/FileSystemJsObject.cpp |
diff --git a/src/FileSystemJsObject.cpp b/src/FileSystemJsObject.cpp |
index 80a9b997c627bfdaaf65e40b6d9cbd0f30a40a04..3a8cda9b16177aca52dee8fcf07baadc48e41685 100644 |
--- a/src/FileSystemJsObject.cpp |
+++ b/src/FileSystemJsObject.cpp |
@@ -27,6 +27,7 @@ |
#include "Utils.h" |
using namespace AdblockPlus; |
+using AdblockPlus::Utils::ThrowException; |
namespace |
{ |
@@ -246,111 +247,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 ThrowException(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 ThrowException(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 ThrowException(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 ThrowException(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 ThrowException(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 ThrowException(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 ThrowException(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 ThrowException(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 ThrowException(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 ThrowException(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 ThrowException(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)); |
} |
- |
} |