Merge pull request #185 from deepak1556/devtools_network_transaction_patch

devtools: exclude devtools related http header from serviceworker context
This commit is contained in:
Cheng Zhao 2015-12-21 10:08:50 +08:00
commit 395a2eb1cc
3 changed files with 11 additions and 6 deletions

View file

@ -15,12 +15,10 @@
namespace brightray {
namespace {
const char kDevToolsEmulateNetworkConditionsClientId[] =
"X-DevTools-Emulate-Network-Conditions-Client-Id";
} // namespace
// static
const char
DevToolsNetworkTransaction::kDevToolsEmulateNetworkConditionsClientId[] =
"X-DevTools-Emulate-Network-Conditions-Client-Id";
DevToolsNetworkTransaction::DevToolsNetworkTransaction(
DevToolsNetworkController* controller,

View file

@ -22,6 +22,8 @@ class DevToolsNetworkInterceptor;
class DevToolsNetworkTransaction : public net::HttpTransaction {
public:
static const char kDevToolsEmulateNetworkConditionsClientId[];
DevToolsNetworkTransaction(
DevToolsNetworkController* controller,
scoped_ptr<net::HttpTransaction> network_transaction);

View file

@ -7,6 +7,7 @@
#include "browser/net/devtools_network_controller.h"
#include "browser/net/devtools_network_transaction.h"
#include "content/public/browser/service_worker_context.h"
#include "net/base/net_errors.h"
#include "net/http/http_network_layer.h"
#include "net/http/http_network_transaction.h"
@ -18,6 +19,10 @@ DevToolsNetworkTransactionFactory::DevToolsNetworkTransactionFactory(
net::HttpNetworkSession* session)
: controller_(controller),
network_layer_(new net::HttpNetworkLayer(session)) {
std::set<std::string> headers;
headers.insert(
DevToolsNetworkTransaction::kDevToolsEmulateNetworkConditionsClientId);
content::ServiceWorkerContext::AddExcludedHeadersForFetchEvent(headers);
}
DevToolsNetworkTransactionFactory::~DevToolsNetworkTransactionFactory() {