| Index: src/JsValue.cpp |
| =================================================================== |
| --- a/src/JsValue.cpp |
| +++ b/src/JsValue.cpp |
| @@ -122,16 +122,22 @@ |
| } |
| std::string AdblockPlus::JsValue::AsString() const |
| { |
| const JsContext context(*jsEngine); |
| return Utils::FromV8String(UnwrapValue()); |
| } |
| +std::vector<char> AdblockPlus::JsValue::AsBuffer() const |
|
sergei
2017/07/06 14:14:05
Since there is a buffer type in JS, what about cal
hub
2017/07/06 14:33:31
I'm ok with AsStringBuffer() like we have AsString
|
| +{ |
| + const JsContext context(*jsEngine); |
| + return Utils::BufferFromV8String(UnwrapValue()); |
| +} |
| + |
| int64_t AdblockPlus::JsValue::AsInt() const |
| { |
| const JsContext context(*jsEngine); |
| return UnwrapValue()->IntegerValue(); |
| } |
| bool AdblockPlus::JsValue::AsBool() const |
| { |
| @@ -198,16 +204,22 @@ |
| } |
| void AdblockPlus::JsValue::SetProperty(const std::string& name, const std::string& val) |
| { |
| const JsContext context(*jsEngine); |
| SetProperty(name, Utils::ToV8String(jsEngine->GetIsolate(), val)); |
| } |
| +void AdblockPlus::JsValue::SetProperty(const std::string& name, const std::vector<char>& val) |
|
hub
2017/07/06 14:33:32
I'll rename it to SetStringProperty then.
sergei
2017/07/07 13:29:27
Could you please rename it?
hub
2017/07/07 13:39:20
Sorry, I had the change shelved by mistake. Curren
|
| +{ |
| + const JsContext context(*jsEngine); |
| + SetProperty(name, Utils::ToV8String(jsEngine->GetIsolate(), val)); |
| +} |
| + |
| void AdblockPlus::JsValue::SetProperty(const std::string& name, int64_t val) |
| { |
| const JsContext context(*jsEngine); |
| SetProperty(name, v8::Number::New(jsEngine->GetIsolate(), val)); |
| } |
| void AdblockPlus::JsValue::SetProperty(const std::string& name, const JsValue& val) |
| { |