| Index: extensions/renderer/api_signature.cc
|
| diff --git a/extensions/renderer/api_signature.cc b/extensions/renderer/api_signature.cc
|
| index e15a53f80392707341e8d3c536a8b3a6658bf49f..b2eb02fc73d7c1699298d63c8eb6550dca7abad9 100644
|
| --- a/extensions/renderer/api_signature.cc
|
| +++ b/extensions/renderer/api_signature.cc
|
| @@ -317,10 +317,13 @@ 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;
|
| + // Bindings should ensure that the value here is appropriate, but see the
|
| + // comment above for limitations.
|
| + DCHECK(value->IsFunction() || value->IsUndefined() || value->IsNull());
|
| + if (value->IsFunction())
|
| + callback = value.As<v8::Function>();
|
| }
|
|
|
| auto json = base::MakeUnique<base::ListValue>();
|
|
|