Chromium Code Reviews| Index: extensions/renderer/api_signature.cc |
| diff --git a/extensions/renderer/api_signature.cc b/extensions/renderer/api_signature.cc |
| index e15a53f80392707341e8d3c536a8b3a6658bf49f..f4d42c875ab581af8066204c482b3b3984aff644 100644 |
| --- a/extensions/renderer/api_signature.cc |
| +++ b/extensions/renderer/api_signature.cc |
| @@ -317,10 +317,11 @@ bool APISignature::ConvertArgumentsIgnoringSchema( |
| // the arguments in the signature. This is very broken. |
| if (HasCallback(signature_)) { |
| CHECK(!arguments.empty()); |
| - if (arguments[size - 1]->IsFunction()) { |
| - callback = arguments[size - 1].As<v8::Function>(); |
| - --size; |
| - } |
| + v8::Local<v8::Value> value = arguments.back(); |
| + --size; |
| + DCHECK(value->IsFunction() || value->IsUndefined() || value->IsNull()); |
|
jbroman
2017/06/05 18:16:32
This DCHECK implies this value can only come from
Devlin
2017/06/09 20:26:31
More-or-less. :/ In theory, we should only get he
|
| + if (value->IsFunction()) |
| + callback = value.As<v8::Function>(); |
| } |
| auto json = base::MakeUnique<base::ListValue>(); |