Always set headers for response

When intercepting HTTP protocols Chromium will assume there is always headers
set, so we have to provide headers for all the responses to avoid the
crash.
This commit is contained in:
Cheng Zhao 2015-08-13 22:26:27 +08:00
parent 467ba6b7a9
commit a88f951b2f

View file

@ -11,6 +11,7 @@
#include "base/values.h"
#include "content/public/browser/browser_thread.h"
#include "net/base/net_errors.h"
#include "net/http/http_response_headers.h"
#include "net/url_request/url_request_context_getter.h"
#include "net/url_request/url_request_job.h"
#include "v8/include/v8.h"
@ -71,6 +72,9 @@ class JsAsker : public RequestJob {
base::Bind(&JsAsker::OnResponse,
weak_factory_.GetWeakPtr())));
}
void GetResponseInfo(net::HttpResponseInfo* info) override {
info->headers = new net::HttpResponseHeaders("");
}
// Called when the JS handler has sent the response, we need to decide whether
// to start, or fail the job.