Fix crash in mate::Converter<const net::URLRequest*>::ToV8
The net::URLRequest::url() method calls vector<GURL>::back(), which is undefined when the url_chain is empty
This commit is contained in:
parent
f3c7965cea
commit
d2b48b2aa7
1 changed files with 3 additions and 1 deletions
|
@ -27,7 +27,9 @@ v8::Local<v8::Value> Converter<const net::URLRequest*>::ToV8(
|
||||||
v8::Isolate* isolate, const net::URLRequest* val) {
|
v8::Isolate* isolate, const net::URLRequest* val) {
|
||||||
scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue);
|
scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue);
|
||||||
dict->SetString("method", val->method());
|
dict->SetString("method", val->method());
|
||||||
dict->SetStringWithoutPathExpansion("url", val->url().spec());
|
std::string url;
|
||||||
|
if (!val->url_chain().empty()) url = val->url().spec();
|
||||||
|
dict->SetStringWithoutPathExpansion("url", url);
|
||||||
dict->SetString("referrer", val->referrer());
|
dict->SetString("referrer", val->referrer());
|
||||||
scoped_ptr<base::ListValue> list(new base::ListValue);
|
scoped_ptr<base::ListValue> list(new base::ListValue);
|
||||||
atom::GetUploadData(list.get(), val);
|
atom::GetUploadData(list.get(), val);
|
||||||
|
|
Loading…
Reference in a new issue