Allow passing null to webRequest

This commit is contained in:
Cheng Zhao 2015-12-11 19:11:09 +08:00
parent b7fce578d5
commit 62f4b25cf9
3 changed files with 6 additions and 8 deletions

View file

@ -28,13 +28,14 @@ WebRequest::~WebRequest() {
template<AtomNetworkDelegate::EventTypes type>
void WebRequest::SetListener(mate::Arguments* args) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
scoped_ptr<base::DictionaryValue> filter(new base::DictionaryValue());
scoped_ptr<base::DictionaryValue> filter(new base::DictionaryValue);
args->GetNext(filter.get());
v8::Local<v8::Value> value;
AtomNetworkDelegate::Listener callback;
if (!args->GetNext(&callback)) {
args->ThrowError("Must pass null or a function");
if (!args->GetNext(&callback) &&
!(args->GetNext(&value) && value->IsNull())) {
args->ThrowError("Must pass null or a Function");
return;
}