Allow passing null to webRequest
This commit is contained in:
parent
b7fce578d5
commit
62f4b25cf9
3 changed files with 6 additions and 8 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -5,8 +5,6 @@
|
|||
#ifndef ATOM_BROWSER_API_ATOM_API_WEB_REQUEST_H_
|
||||
#define ATOM_BROWSER_API_ATOM_API_WEB_REQUEST_H_
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "atom/browser/api/trackable_object.h"
|
||||
#include "atom/browser/net/atom_network_delegate.h"
|
||||
#include "native_mate/arguments.h"
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
|
||||
#include <map>
|
||||
#include <set>
|
||||
#include <string>
|
||||
|
||||
#include "brightray/browser/network_delegate.h"
|
||||
#include "base/callback.h"
|
||||
|
|
Loading…
Reference in a new issue