Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2204)

Unified Diff: extensions/renderer/api_last_error.cc

Issue 2819683002: [Extenisons Bindings] Don't throw unchecked errors; add console errors (Closed)
Patch Set: . Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: extensions/renderer/api_last_error.cc
diff --git a/extensions/renderer/api_last_error.cc b/extensions/renderer/api_last_error.cc
index 4073d276c09a526981cceb2d58fc5737e0e3319d..ece0de11dd2de4d988d0f70654a7eb3658a93094 100644
--- a/extensions/renderer/api_last_error.cc
+++ b/extensions/renderer/api_last_error.cc
@@ -53,8 +53,9 @@ gin::WrapperInfo LastErrorObject::kWrapperInfo = {gin::kEmbedderNativeGin};
} // namespace
-APILastError::APILastError(const GetParent& get_parent)
- : get_parent_(get_parent) {}
+APILastError::APILastError(const GetParent& get_parent,
+ const AddConsoleError& add_console_error)
+ : get_parent_(get_parent), add_console_error_(add_console_error) {}
APILastError::APILastError(APILastError&& other) = default;
APILastError::~APILastError() = default;
@@ -133,8 +134,8 @@ void APILastError::ClearError(v8::Local<v8::Context> context,
}
if (report_if_unchecked && !last_error->accessed()) {
- isolate->ThrowException(
- v8::Exception::Error(gin::StringToV8(isolate, last_error->error())));
+ add_console_error_.Run(
jbroman 2017/04/19 17:45:04 Heh, I'd missed that the original code used consol
lazyboy 2017/04/19 18:45:40 I might be missing something, but add_console_erro
Devlin 2017/04/19 19:45:33 I don't think it should ever be null for non-test
Devlin 2017/04/19 19:45:33 Clearly, I did too. :)
lazyboy 2017/04/19 20:28:07 Nope. Looking again, I think I misread api_binding
+ context, "Unchecked runtime.lastError: " + last_error->error());
}
// See comment in SetError().

Powered by Google App Engine
This is Rietveld 408576698