| Index: extensions/renderer/api_last_error.cc
|
| diff --git a/extensions/renderer/api_last_error.cc b/extensions/renderer/api_last_error.cc
|
| index 12111d23d1398e4119f452a46b57b618413c12dc..4073d276c09a526981cceb2d58fc5737e0e3319d 100644
|
| --- a/extensions/renderer/api_last_error.cc
|
| +++ b/extensions/renderer/api_last_error.cc
|
| @@ -146,4 +146,26 @@ void APILastError::ClearError(v8::Local<v8::Context> context,
|
| parent->Delete(context, key).ToChecked();
|
| }
|
|
|
| +bool APILastError::HasError(v8::Local<v8::Context> context) {
|
| + v8::Isolate* isolate = context->GetIsolate();
|
| + v8::HandleScope handle_scope(isolate);
|
| +
|
| + // See comment in SetError().
|
| + v8::TryCatch try_catch(isolate);
|
| + try_catch.SetVerbose(true);
|
| +
|
| + v8::Local<v8::Object> parent = get_parent_.Run(context);
|
| + if (parent.IsEmpty())
|
| + return false;
|
| + v8::Local<v8::Value> error;
|
| + if (!parent->Get(context, gin::StringToSymbol(isolate, kLastErrorProperty))
|
| + .ToLocal(&error)) {
|
| + return false;
|
| + }
|
| +
|
| + LastErrorObject* last_error = nullptr;
|
| + return gin::Converter<LastErrorObject*>::FromV8(context->GetIsolate(), error,
|
| + &last_error);
|
| +}
|
| +
|
| } // namespace extensions
|
|
|