#include "extensions/renderer/bindings/exception_handler.h"
#include "base/check.h"
#include "base/strings/stringprintf.h"
#include "base/supports_user_data.h"
#include "extensions/renderer/bindings/api_binding_util.h"
#include "extensions/renderer/bindings/get_per_context_data.h"
#include "extensions/renderer/bindings/js_runner.h"
#include "gin/converter.h"
#include "gin/handle.h"
#include "gin/per_context_data.h"
#include "gin/wrappable.h"
namespace extensions {
namespace {
struct ExceptionHandlerPerContextData : public base::SupportsUserData::Data { … };
constexpr char ExceptionHandlerPerContextData::kPerContextDataKey[];
class WrappedExceptionHandler : public gin::Wrappable<WrappedExceptionHandler> { … };
gin::WrapperInfo WrappedExceptionHandler::kWrapperInfo = …;
}
ExceptionHandler::ExceptionHandler(
const binding::AddConsoleError& add_console_error)
: … { … }
ExceptionHandler::~ExceptionHandler() = default;
v8::Local<v8::Value> ExceptionHandler::GetV8Wrapper(v8::Isolate* isolate) { … }
ExceptionHandler* ExceptionHandler::FromV8Wrapper(v8::Isolate* isolate,
v8::Local<v8::Value> value) { … }
void ExceptionHandler::HandleException(v8::Local<v8::Context> context,
const std::string& message,
v8::TryCatch* try_catch) { … }
void ExceptionHandler::HandleException(v8::Local<v8::Context> context,
const std::string& full_message,
v8::Local<v8::Value> exception_value) { … }
void ExceptionHandler::SetHandlerForContext(v8::Local<v8::Context> context,
v8::Local<v8::Function> handler) { … }
void ExceptionHandler::RunExtensionCallback(
v8::Local<v8::Context> context,
v8::Local<v8::Function> extension_callback,
v8::LocalVector<v8::Value> callback_arguments,
const std::string& message) { … }
v8::Local<v8::Function> ExceptionHandler::GetCustomHandler(
v8::Local<v8::Context> context) { … }
}