gin: fix crash on concat strings passed to ThrowError
V8TypeAsString was passing nullptr to the ConvertFromV8 function, so now
we always pass the isolate. Also adds a DCHECK to ensure that V8ToString
to ConvertFromV8 to ensure it's always passed a non-null Isolate.
Bug: 866767
Change-Id: I715396f309a0c49e4c6bc6ade14b5f0aad8befec
Reviewed-on: https://chromium-review.googlesource.com/1148209
Reviewed-by: Ross McIlroy <[email protected]>
Commit-Queue: Dan Elphick <[email protected]>
Cr-Commit-Position: refs/heads/master@{#577597}
diff --git a/gin/arguments.cc b/gin/arguments.cc
index b492fae6..82d5f43 100644
--- a/gin/arguments.cc
+++ b/gin/arguments.cc
@@ -48,7 +48,7 @@
return info_->Holder()->CreationContext();
}
-std::string V8TypeAsString(v8::Local<v8::Value> value) {
+std::string V8TypeAsString(v8::Isolate* isolate, v8::Local<v8::Value> value) {
if (value.IsEmpty())
return "<empty handle>";
if (value->IsUndefined())
@@ -56,7 +56,7 @@
if (value->IsNull())
return "null";
std::string result;
- if (!ConvertFromV8(NULL, value, &result))
+ if (!ConvertFromV8(isolate, value, &result))
return std::string();
return result;
}
@@ -67,7 +67,7 @@
return ThrowTypeError(base::StringPrintf(
"Error processing argument at index %d, conversion failure from %s",
- next_ - 1, V8TypeAsString((*info_)[next_ - 1]).c_str()));
+ next_ - 1, V8TypeAsString(isolate_, (*info_)[next_ - 1]).c_str()));
}
void Arguments::ThrowTypeError(const std::string& message) const {