OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/browser/frame_host/frame_navigation_entry.h" | 5 #include "content/browser/frame_host/frame_navigation_entry.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "content/common/page_state_serialization.h" | 9 #include "content/common/page_state_serialization.h" |
10 #include "content/common/site_isolation_policy.h" | 10 #include "content/common/site_isolation_policy.h" |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
83 document_sequence_number_ = document_sequence_number; | 83 document_sequence_number_ = document_sequence_number; |
84 } | 84 } |
85 | 85 |
86 void FrameNavigationEntry::SetPageState(const PageState& page_state) { | 86 void FrameNavigationEntry::SetPageState(const PageState& page_state) { |
87 page_state_ = page_state; | 87 page_state_ = page_state; |
88 | 88 |
89 ExplodedPageState exploded_state; | 89 ExplodedPageState exploded_state; |
90 if (!DecodePageState(page_state_.ToEncodedData(), &exploded_state)) | 90 if (!DecodePageState(page_state_.ToEncodedData(), &exploded_state)) |
91 return; | 91 return; |
92 | 92 |
93 item_sequence_number_ = exploded_state.top.item_sequence_number; | 93 // If the item_sequence_number_ field is already populated, then set it only |
94 document_sequence_number_ = exploded_state.top.document_sequence_number; | 94 // if the item sequence number decoded from the page state is valid. This |
95 // typically happens in tests. | |
96 if (exploded_state.top.item_sequence_number > 0 || | |
nasko
2016/09/07 20:56:02
I don't think this is the correct approach. The wh
ananta
2016/09/07 22:50:06
Added the functionality to the test code. PTAL
| |
97 item_sequence_number_ < 0) { | |
98 item_sequence_number_ = exploded_state.top.item_sequence_number; | |
99 } | |
100 // Please refer to the comment above for explanation. | |
101 if (exploded_state.top.document_sequence_number > 0 || | |
102 document_sequence_number_ < 0) { | |
103 document_sequence_number_ = exploded_state.top.document_sequence_number; | |
104 } | |
95 } | 105 } |
96 | 106 |
97 scoped_refptr<ResourceRequestBodyImpl> FrameNavigationEntry::GetPostData() | 107 scoped_refptr<ResourceRequestBodyImpl> FrameNavigationEntry::GetPostData() |
98 const { | 108 const { |
99 DCHECK(SiteIsolationPolicy::UseSubframeNavigationEntries()); | 109 DCHECK(SiteIsolationPolicy::UseSubframeNavigationEntries()); |
100 if (method_ != "POST") | 110 if (method_ != "POST") |
101 return nullptr; | 111 return nullptr; |
102 | 112 |
103 // Generate the body from the PageState. | 113 // Generate the body from the PageState. |
104 ExplodedPageState exploded_state; | 114 ExplodedPageState exploded_state; |
105 if (!DecodePageState(page_state_.ToEncodedData(), &exploded_state)) | 115 if (!DecodePageState(page_state_.ToEncodedData(), &exploded_state)) |
106 return nullptr; | 116 return nullptr; |
107 | 117 |
108 return exploded_state.top.http_body.request_body; | 118 return exploded_state.top.http_body.request_body; |
109 } | 119 } |
110 | 120 |
111 } // namespace content | 121 } // namespace content |
OLD | NEW |