Commit ee52cf0b authored by Eugene But's avatar Eugene But Committed by Commit Bot

Fixed NavigationItemImpl copy constructor.

Make mutableCopy of http_request_headers_ to avoid crashes in
AddHttpRequestHeaders and RemoveHttpRequestHeaderForKey.

Bug: 798070
Cq-Include-Trybots: master.tryserver.chromium.mac:ios-simulator-cronet;master.tryserver.chromium.mac:ios-simulator-full-configs
Change-Id: Iaca5eb950f79b5936a75523392322036a37158a5
Reviewed-on: https://chromium-review.googlesource.com/846433
Commit-Queue: Eugene But <eugenebut@chromium.org>
Reviewed-by: default avatarMike Dougherty <michaeldo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#526775}
parent 1b05bd07
......@@ -66,7 +66,7 @@ NavigationItemImpl::NavigationItemImpl(const NavigationItemImpl& item)
ssl_(item.ssl_),
timestamp_(item.timestamp_),
user_agent_type_(item.user_agent_type_),
http_request_headers_([item.http_request_headers_ copy]),
http_request_headers_([item.http_request_headers_ mutableCopy]),
serialized_state_object_([item.serialized_state_object_ copy]),
is_created_from_push_state_(item.is_created_from_push_state_),
has_state_been_replaced_(item.has_state_been_replaced_),
......
......@@ -90,6 +90,9 @@ TEST_F(NavigationItemTest, Copy) {
EXPECT_NSEQ([postData0 dataUsingEncoding:NSUTF8StringEncoding],
copy.GetPostData());
EXPECT_NSEQ(state0, copy.GetSerializedStateObject());
// Ensure that HTTP headers are still mutable after the copying.
copy.AddHttpRequestHeaders(@{});
}
// Tests whether |NavigationItem::AddHttpRequestHeaders()| adds the passed
......
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