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

Unified Diff: src/JsError.cpp

Issue 29809555: Issue #6526 - pass v8::Isolate to more functions because old approach is deprecated (Closed) Base URL: https://github.com/adblockplus/libadblockplus@4d9bcc12e77369cbc4bc04bace9a3e7fa03de17b
Patch Set: Created June 18, 2018, 10:22 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
Index: src/JsError.cpp
diff --git a/src/JsError.cpp b/src/JsError.cpp
index 3c5565a8a332c0e72974b8c83c62c918e815a92b..1484a17943f4919fa630241080531072f95b3028 100644
--- a/src/JsError.cpp
+++ b/src/JsError.cpp
@@ -19,23 +19,28 @@
using namespace AdblockPlus;
-JsError::JsError(const v8::Local<v8::Value>& exception,
+JsError::JsError(v8::Isolate* isolate, const v8::Local<v8::Value>& exception,
const v8::Local<v8::Message>& message)
- : std::runtime_error(ExceptionToString(exception, message))
+ : std::runtime_error(ExceptionToString(isolate, exception, message))
{
}
-std::string JsError::ExceptionToString(const v8::Local<v8::Value>& exception,
+std::string JsError::ExceptionToString(v8::Isolate* isolate, const v8::Local<v8::Value>& exception,
const v8::Local<v8::Message>& message)
{
std::stringstream error;
- error << *v8::String::Utf8Value(exception);
+ error << *v8::String::Utf8Value(isolate, exception);
if (!message.IsEmpty())
{
error << " at ";
- error << *v8::String::Utf8Value(message->GetScriptResourceName());
+ error << *v8::String::Utf8Value(isolate, message->GetScriptResourceName());
error << ":";
- error << message->GetLineNumber();
+ auto maybeLineNumber = message->GetLineNumber(isolate->GetCurrentContext());
+ int lineNumber = 0;
+ if (maybeLineNumber.To(&lineNumber))
+ error << lineNumber;
+ else
+ error << "unknown line";
}
return error.str();
}
« src/FileSystemJsObject.cpp ('K') | « src/JsError.h ('k') | src/JsValue.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld