Merge pull request #11268 from electron/fix_crash
Don't access unique pointer after it was moved from
This commit is contained in:
commit
e24cd329d9
1 changed files with 12 additions and 7 deletions
|
@ -800,16 +800,21 @@ void InspectableWebContentsImpl::OnURLFetchComplete(
|
||||||
DCHECK(it != pending_requests_.end());
|
DCHECK(it != pending_requests_.end());
|
||||||
|
|
||||||
base::DictionaryValue response;
|
base::DictionaryValue response;
|
||||||
auto headers = base::MakeUnique<base::DictionaryValue>();
|
|
||||||
net::HttpResponseHeaders* rh = source->GetResponseHeaders();
|
net::HttpResponseHeaders* rh = source->GetResponseHeaders();
|
||||||
response.SetInteger("statusCode", rh ? rh->response_code() : 200);
|
response.SetInteger("statusCode", rh ? rh->response_code() : 200);
|
||||||
response.Set("headers", std::move(headers));
|
|
||||||
|
|
||||||
size_t iterator = 0;
|
{
|
||||||
std::string name;
|
auto headers = base::MakeUnique<base::DictionaryValue>();
|
||||||
std::string value;
|
|
||||||
while (rh && rh->EnumerateHeaderLines(&iterator, &name, &value))
|
size_t iterator = 0;
|
||||||
headers->SetString(name, value);
|
std::string name;
|
||||||
|
std::string value;
|
||||||
|
while (rh && rh->EnumerateHeaderLines(&iterator, &name, &value))
|
||||||
|
headers->SetString(name, value);
|
||||||
|
|
||||||
|
response.Set("headers", std::move(headers));
|
||||||
|
}
|
||||||
|
|
||||||
it->second.Run(&response);
|
it->second.Run(&response);
|
||||||
pending_requests_.erase(it);
|
pending_requests_.erase(it);
|
||||||
|
|
Loading…
Reference in a new issue