| Index: extensions/renderer/api_last_error.cc
|
| diff --git a/extensions/renderer/api_last_error.cc b/extensions/renderer/api_last_error.cc
|
| index 2dafc5e16a2446b916eb904a503d8939f9b6729f..02c5b70b67b4da58955fe1fc621b1eccffc5bcf2 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);
|
| }
|
|
|
| +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
|
|
|