Commit d35e08b7 authored by Johannes Henkel's avatar Johannes Henkel Committed by Commit Bot

Use ClearAllFields() when we're disabling.

inspector_network_agent.cc:
This is a behavior change, there are a fair number of fields here.
E.g., previously, the extra headers would be preserved between
disable() and enable(), now they're cleared out.

inspector_page_agent.cc:
Similarly, this is a behavior change.
E.g., previously, setFontFamilies and setFontSizes settings would
be preserved between disable() and enable(), now it's cleared out.

Bug: 851762
Change-Id: I923a2d49ec92f395c5954116e115686517994a0f
Reviewed-on: https://chromium-review.googlesource.com/1161175Reviewed-by: default avatarAndrey Kosyakov <caseq@chromium.org>
Commit-Queue: Johannes Henkel <johannes@chromium.org>
Cr-Commit-Position: refs/heads/master@{#580646}
parent 5a0d0bfa
...@@ -1322,15 +1322,15 @@ void InspectorNetworkAgent::Enable() { ...@@ -1322,15 +1322,15 @@ void InspectorNetworkAgent::Enable() {
Response InspectorNetworkAgent::disable() { Response InspectorNetworkAgent::disable() {
DCHECK(!pending_request_); DCHECK(!pending_request_);
enabled_.Set(false);
instrumenting_agents_->removeInspectorNetworkAgent(this); instrumenting_agents_->removeInspectorNetworkAgent(this);
agent_state_.ClearAllFields();
resources_data_->Clear(); resources_data_->Clear();
return Response::OK(); return Response::OK();
} }
Response InspectorNetworkAgent::setExtraHTTPHeaders( Response InspectorNetworkAgent::setExtraHTTPHeaders(
std::unique_ptr<protocol::Network::Headers> headers) { std::unique_ptr<protocol::Network::Headers> headers) {
extra_request_headers_.ClearAll(); extra_request_headers_.Clear();
std::unique_ptr<protocol::DictionaryValue> in = headers->toValue(); std::unique_ptr<protocol::DictionaryValue> in = headers->toValue();
for (size_t i = 0; i < in->size(); ++i) { for (size_t i = 0; i < in->size(); ++i) {
const auto& entry = in->at(i); const auto& entry = in->at(i);
...@@ -1389,7 +1389,7 @@ void InspectorNetworkAgent::getResponseBody( ...@@ -1389,7 +1389,7 @@ void InspectorNetworkAgent::getResponseBody(
Response InspectorNetworkAgent::setBlockedURLs( Response InspectorNetworkAgent::setBlockedURLs(
std::unique_ptr<protocol::Array<String>> urls) { std::unique_ptr<protocol::Array<String>> urls) {
blocked_urls_.ClearAll(); blocked_urls_.Clear();
for (size_t i = 0; i < urls->length(); i++) for (size_t i = 0; i < urls->length(); i++)
blocked_urls_.Set(urls->get(i), true); blocked_urls_.Set(urls->get(i), true);
return Response::OK(); return Response::OK();
......
...@@ -527,8 +527,7 @@ Response InspectorPageAgent::enable() { ...@@ -527,8 +527,7 @@ Response InspectorPageAgent::enable() {
} }
Response InspectorPageAgent::disable() { Response InspectorPageAgent::disable() {
enabled_.Set(false); agent_state_.ClearAllFields();
scripts_to_evaluate_on_load_.ClearAll();
script_to_evaluate_on_load_once_ = String(); script_to_evaluate_on_load_once_ = String();
pending_script_to_evaluate_on_load_once_ = String(); pending_script_to_evaluate_on_load_once_ = String();
instrumenting_agents_->removeInspectorPageAgent(this); instrumenting_agents_->removeInspectorPageAgent(this);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment