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

Unified Diff: extensions/renderer/v8_schema_registry.cc

Issue 2254383002: Signal extension API schema corruption to the browser process. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments Created 4 years, 4 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/v8_schema_registry.cc
diff --git a/extensions/renderer/v8_schema_registry.cc b/extensions/renderer/v8_schema_registry.cc
index 2db2bb30dae2033d07346734a0b6e496e4c3be3f..f2ca4baa8c0c63a85854d09c6673cf26030670e9 100644
--- a/extensions/renderer/v8_schema_registry.cc
+++ b/extensions/renderer/v8_schema_registry.cc
@@ -11,7 +11,9 @@
#include "base/logging.h"
#include "base/values.h"
#include "content/public/child/v8_value_converter.h"
+#include "content/public/renderer/render_thread.h"
#include "extensions/common/extension_api.h"
+#include "extensions/common/extension_messages.h"
#include "extensions/renderer/object_backed_native_handler.h"
#include "extensions/renderer/script_context.h"
#include "extensions/renderer/v8_helpers.h"
@@ -131,7 +133,16 @@ v8::Local<v8::Object> V8SchemaRegistry::GetSchema(const std::string& api) {
const base::DictionaryValue* schema =
ExtensionAPI::GetSharedInstance()->GetSchema(api);
- CHECK(schema) << api;
+
+ // If the schema for |api| cannot be loaded then return an empty object, but
+ // also notify the browser so that it can take appropriate action.
+ // See http://crbug.com/121424.
+ if (!schema) {
+ content::RenderThread::Get()->Send(
+ new ExtensionHostMsg_NotifyBadExtensionApiSchema(api));
+ return v8::Local<v8::Object>();
+ }
+
std::unique_ptr<V8ValueConverter> v8_value_converter(
V8ValueConverter::create());
v8::Local<v8::Value> value = v8_value_converter->ToV8Value(schema, context);
« extensions/browser/extension_message_filter.cc ('K') | « extensions/common/extension_messages.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698