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>
|
template<AtomNetworkDelegate::EventTypes type>
|
||||||
void WebRequest::SetListener(mate::Arguments* args) {
|
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());
|
args->GetNext(filter.get());
|
||||||
|
|
||||||
|
v8::Local<v8::Value> value;
|
||||||
AtomNetworkDelegate::Listener callback;
|
AtomNetworkDelegate::Listener callback;
|
||||||
if (!args->GetNext(&callback)) {
|
if (!args->GetNext(&callback) &&
|
||||||
args->ThrowError("Must pass null or a function");
|
!(args->GetNext(&value) && value->IsNull())) {
|
||||||
|
args->ThrowError("Must pass null or a Function");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,8 +5,6 @@
|
||||||
#ifndef ATOM_BROWSER_API_ATOM_API_WEB_REQUEST_H_
|
#ifndef ATOM_BROWSER_API_ATOM_API_WEB_REQUEST_H_
|
||||||
#define 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/api/trackable_object.h"
|
||||||
#include "atom/browser/net/atom_network_delegate.h"
|
#include "atom/browser/net/atom_network_delegate.h"
|
||||||
#include "native_mate/arguments.h"
|
#include "native_mate/arguments.h"
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <string>
|
|
||||||
|
|
||||||
#include "brightray/browser/network_delegate.h"
|
#include "brightray/browser/network_delegate.h"
|
||||||
#include "base/callback.h"
|
#include "base/callback.h"
|
||||||
|
|
Loading…
Reference in a new issue