| Index: extensions/renderer/argument_spec.cc
|
| diff --git a/extensions/renderer/argument_spec.cc b/extensions/renderer/argument_spec.cc
|
| index bae1a7b5bfa44058380d4e5260bc50ef6dfba796..3001fe1ee6909443ad6c68cc1ff5c8298d60a5dc 100644
|
| --- a/extensions/renderer/argument_spec.cc
|
| +++ b/extensions/renderer/argument_spec.cc
|
| @@ -144,9 +144,18 @@ bool ArgumentSpec::ParseArgument(v8::Local<v8::Context> context,
|
| std::unique_ptr<base::Value>* out_value,
|
| std::string* error) const {
|
| if (type_ == ArgumentType::FUNCTION) {
|
| - // We can't serialize functions. We shouldn't be asked to.
|
| - DCHECK(!out_value);
|
| - return value->IsFunction();
|
| + if (!value->IsFunction())
|
| + return false;
|
| +
|
| + if (out_value) {
|
| + // Certain APIs (contextMenus) have functions as parameters other than the
|
| + // callback (contextMenus uses it for an onclick listener). Our generated
|
| + // types have adapted to consider functions "objects" and serialize them
|
| + // as dictionaries.
|
| + // TODO(devlin): It'd be awfully nice to get rid of this eccentricity.
|
| + *out_value = base::MakeUnique<base::DictionaryValue>();
|
| + }
|
| + return true;
|
| }
|
|
|
| if (type_ == ArgumentType::REF) {
|
|
|