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

Unified Diff: src/JsValue.cpp

Issue 29810573: Issue 6526 - Remove deprecated Utf8Value() usage (Closed) Base URL: https://hg.adblockplus.org/libadblockplus/
Patch Set: Created June 19, 2018, 5:11 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/JsError.cpp ('k') | src/Utils.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/JsValue.cpp
===================================================================
--- a/src/JsValue.cpp
+++ b/src/JsValue.cpp
@@ -119,23 +119,23 @@
{
const JsContext context(*jsEngine);
return UnwrapValue()->IsFunction();
}
std::string AdblockPlus::JsValue::AsString() const
{
const JsContext context(*jsEngine);
- return Utils::FromV8String(UnwrapValue());
+ return Utils::FromV8String(jsEngine->GetIsolate(), UnwrapValue());
}
StringBuffer AdblockPlus::JsValue::AsStringBuffer() const
{
const JsContext context(*jsEngine);
- return Utils::StringBufferFromV8String(UnwrapValue());
+ return Utils::StringBufferFromV8String(jsEngine->GetIsolate(), UnwrapValue());
}
int64_t AdblockPlus::JsValue::AsInt() const
{
const JsContext context(*jsEngine);
return UnwrapValue()->IntegerValue();
}
@@ -235,17 +235,17 @@
std::string AdblockPlus::JsValue::GetClass() const
{
if (!IsObject())
throw std::runtime_error("Cannot get constructor of a non-object");
const JsContext context(*jsEngine);
v8::Local<v8::Object> obj = v8::Local<v8::Object>::Cast(UnwrapValue());
- return Utils::FromV8String(obj->GetConstructorName());
+ return Utils::FromV8String(jsEngine->GetIsolate(), obj->GetConstructorName());
}
JsValue JsValue::Call(const JsValueList& params) const
{
const JsContext context(*jsEngine);
std::vector<v8::Local<v8::Value>> argv;
for (const auto& param : params)
argv.push_back(param.UnwrapValue());
@@ -285,12 +285,12 @@
const JsContext context(*jsEngine);
const v8::TryCatch tryCatch(jsEngine->GetIsolate());
v8::Local<v8::Function> func = v8::Local<v8::Function>::Cast(UnwrapValue());
v8::Local<v8::Value> result = func->Call(thisObj, args.size(),
args.size() ? &args[0] : nullptr);
if (tryCatch.HasCaught())
- throw JsError(tryCatch.Exception(), tryCatch.Message());
+ throw JsError(jsEngine->GetIsolate(), tryCatch.Exception(), tryCatch.Message());
return JsValue(jsEngine, result);
}
« no previous file with comments | « src/JsError.cpp ('k') | src/Utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld