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

Unified Diff: extensions/common/extension_api.cc

Issue 2275813002: Revert of Signal extension API schema corruption to the browser process. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
« no previous file with comments | « extensions/common/extension_api.h ('k') | extensions/common/extension_messages.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/common/extension_api.cc
diff --git a/extensions/common/extension_api.cc b/extensions/common/extension_api.cc
index 1e70cb7ed3b063feebfe55ed59e9de0d80d673b8..4b49a83f8e5f70492f0aee34901739c1b85f1ce7 100644
--- a/extensions/common/extension_api.cc
+++ b/extensions/common/extension_api.cc
@@ -55,24 +55,15 @@
NULL, // error code
&error_message));
-#if DCHECK_IS_ON()
- // |schema| comes from JSON hard-coded to the Chrome binary, so in principle
- // failure to parse indicates we generated corrupted JSON, but in practice
- // corruption of the Chrome binary (e.g. disk errors) can also break it.
- // See http://crbug.com/121424.
- if (!result || !result->IsType(base::Value::TYPE_LIST)) {
- char buf[128];
- base::snprintf(buf, arraysize(buf), "%s: (%d) '%s'", name.c_str(),
- result.get() ? result->GetType() : -1,
- error_message.c_str());
-
- DCHECK(result) << "JSON parse failed: " << buf;
- DCHECK(result->IsType(base::Value::TYPE_LIST)) << "JSON wrong type: "
- << buf;
- }
-#endif // DCHECK_IS_ON()
-
- // From() returns null if passed a null or non-list value.
+ // Tracking down http://crbug.com/121424
+ char buf[128];
+ base::snprintf(buf, arraysize(buf), "%s: (%d) '%s'",
+ name.c_str(),
+ result.get() ? result->GetType() : -1,
+ error_message.c_str());
+
+ CHECK(result.get()) << error_message << " for schema " << schema;
+ CHECK(result->IsType(base::Value::TYPE_LIST)) << " for schema " << schema;
return base::ListValue::From(std::move(result));
}
@@ -223,9 +214,6 @@
void ExtensionAPI::LoadSchema(const std::string& name,
const base::StringPiece& schema) {
std::unique_ptr<base::ListValue> schema_list(LoadSchemaList(name, schema));
- if (!schema_list)
- return;
-
std::string schema_namespace;
extensions::ExtensionsClient* extensions_client =
extensions::ExtensionsClient::Get();
@@ -343,12 +331,7 @@
}
maybe_schema = schemas_.find(api_name);
- // If the schema failed to load then return null for it, rather than
- // crashing, so that the browser can be notified of the problem.
- // See http://crbug.com/121424.
- if (schemas_.end() == maybe_schema)
- return NULL;
-
+ CHECK(schemas_.end() != maybe_schema);
result = maybe_schema->second.get();
}
@@ -407,9 +390,7 @@
api_name_candidate = api_name_candidate.substr(0, last_dot_index);
}
- if (child_name)
- *child_name = "";
-
+ *child_name = "";
return std::string();
}
« no previous file with comments | « extensions/common/extension_api.h ('k') | extensions/common/extension_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698