1
# Description: Revert https://src.chromium.org/viewvc/chrome?revision=289777&view=revision
2
# as it causes a browser crash
3
# Author: Chris Coulson <chris.coulson@canonical.com>
5
diff --git a/content/browser/frame_host/navigation_controller_impl_unittest.cc b/content/browser/frame_host/navigation_controller_impl_unittest.cc
6
--- a/content/browser/frame_host/navigation_controller_impl_unittest.cc
7
+++ b/content/browser/frame_host/navigation_controller_impl_unittest.cc
8
@@ -997,17 +997,17 @@ TEST_F(NavigationControllerTest, LoadURL
9
NavigationControllerImpl& controller = controller_impl();
10
TestNotificationTracker notifications;
11
RegisterForAllNavNotifications(¬ifications, &controller);
13
// First make an existing committed entry.
14
const GURL kExistingURL("http://foo/eh");
15
controller.LoadURL(kExistingURL, content::Referrer(),
16
content::PAGE_TRANSITION_TYPED, std::string());
17
- main_test_rfh()->SendNavigate(1, kExistingURL);
18
+ main_test_rfh()->SendNavigate(0, kExistingURL);
19
EXPECT_EQ(1U, navigation_entry_committed_counter_);
20
navigation_entry_committed_counter_ = 0;
22
// Set a WebContentsDelegate to listen for state changes.
23
scoped_ptr<TestWebContentsDelegate> delegate(new TestWebContentsDelegate());
24
EXPECT_FALSE(contents()->GetDelegate());
25
contents()->SetDelegate(delegate.get());
27
@@ -1025,17 +1025,17 @@ TEST_F(NavigationControllerTest, LoadURL
29
// The visible entry should be the last committed URL, not the pending one.
30
EXPECT_EQ(kExistingURL, controller.GetVisibleEntry()->GetURL());
32
// Now the navigation redirects.
33
const GURL kRedirectURL("http://foo/see");
34
main_test_rfh()->OnMessageReceived(
35
FrameHostMsg_DidRedirectProvisionalLoad(0, // routing_id
36
- 1, // pending page_id
37
+ -1, // pending page_id
39
kRedirectURL)); // new url
41
// We don't want to change the NavigationEntry's url, in case it cancels.
42
// Prevents regression of http://crbug.com/77786.
43
EXPECT_EQ(kNewURL, controller.GetPendingEntry()->GetURL());
45
// It may abort before committing, if it's a download or due to a stop or
46
diff --git a/content/browser/frame_host/render_frame_host_impl.cc b/content/browser/frame_host/render_frame_host_impl.cc
47
--- a/content/browser/frame_host/render_frame_host_impl.cc
48
+++ b/content/browser/frame_host/render_frame_host_impl.cc
49
@@ -553,19 +553,18 @@ void RenderFrameHostImpl::OnDidFailLoadW
50
frame_tree_node_->navigator()->DidFailLoadWithError(
51
this, validated_url, error_code, error_description);
54
void RenderFrameHostImpl::OnDidRedirectProvisionalLoad(
56
const GURL& source_url,
57
const GURL& target_url) {
58
- CHECK_EQ(render_view_host_->page_id_, page_id);
59
frame_tree_node_->navigator()->DidRedirectProvisionalLoad(
60
- this, render_view_host_->page_id_, source_url, target_url);
61
+ this, page_id, source_url, target_url);
64
// Called when the renderer navigates. For every frame loaded, we'll get this
65
// notification containing parameters identifying the navigation.
67
// Subframes are identified by the page transition type. For subframes loaded
68
// as part of a wider page load, the page_id will be the same as for the top
69
// level frame. If the user explicitly requests a subframe navigation, we will
70
@@ -575,20 +574,16 @@ void RenderFrameHostImpl::OnNavigate(con
71
// Read the parameters out of the IPC message directly to avoid making another
72
// copy when we filter the URLs.
73
PickleIterator iter(msg);
74
FrameHostMsg_DidCommitProvisionalLoad_Params validated_params;
75
if (!IPC::ParamTraits<FrameHostMsg_DidCommitProvisionalLoad_Params>::
76
Read(&msg, &iter, &validated_params))
79
- // Update the RVH's current page ID so that future IPCs from the renderer
80
- // correspond to the new page.
81
- render_view_host_->page_id_ = validated_params.page_id;
83
// If we're waiting for a cross-site beforeunload ack from this renderer and
84
// we receive a Navigate message from the main frame, then the renderer was
85
// navigating already and sent it before hearing the ViewMsg_Stop message.
86
// We do not want to cancel the pending navigation in this case, since the
87
// old page will soon be stopped. Instead, treat this as a beforeunload ack
88
// to allow the pending navigation to continue.
89
if (render_view_host_->is_waiting_for_beforeunload_ack_ &&
90
render_view_host_->unload_ack_is_for_cross_site_transition_ &&
91
@@ -890,25 +885,24 @@ void RenderFrameHostImpl::OnDidDisownOpe
92
// mirroring works correctly, add a check here to enforce it.
93
delegate_->DidDisownOpener(this);
96
void RenderFrameHostImpl::OnUpdateTitle(
98
const base::string16& title,
99
blink::WebTextDirection title_direction) {
100
- CHECK_EQ(render_view_host_->page_id_, page_id);
101
// This message is only sent for top-level frames. TODO(avi): when frame tree
102
// mirroring works correctly, add a check here to enforce it.
103
if (title.length() > kMaxTitleChars) {
104
NOTREACHED() << "Renderer sent too many characters in title.";
108
- delegate_->UpdateTitle(this, render_view_host_->page_id_, title,
109
+ delegate_->UpdateTitle(this, page_id, title,
110
WebTextDirectionToChromeTextDirection(
114
void RenderFrameHostImpl::OnUpdateEncoding(const std::string& encoding_name) {
115
// This message is only sent for top-level frames. TODO(avi): when frame tree
116
// mirroring works correctly, add a check here to enforce it.
117
delegate_->UpdateEncoding(this, encoding_name);
118
diff --git a/content/browser/renderer_host/render_view_host_impl.cc b/content/browser/renderer_host/render_view_host_impl.cc
119
--- a/content/browser/renderer_host/render_view_host_impl.cc
120
+++ b/content/browser/renderer_host/render_view_host_impl.cc
121
@@ -183,17 +183,16 @@ RenderViewHostImpl::RenderViewHostImpl(
122
instance->GetProcess(),
125
frames_ref_count_(0),
127
instance_(static_cast<SiteInstanceImpl*>(instance)),
128
waiting_for_drag_context_response_(false),
129
enabled_bindings_(0),
131
main_frame_routing_id_(main_frame_routing_id),
132
run_modal_reply_msg_(NULL),
133
run_modal_opener_id_(MSG_ROUTING_NONE),
134
is_waiting_for_beforeunload_ack_(false),
135
unload_ack_is_for_cross_site_transition_(false),
136
sudden_termination_allowed_(false),
137
render_view_termination_status_(base::TERMINATION_STATUS_STILL_RUNNING),
138
virtual_keyboard_requested_(false),
139
@@ -1073,31 +1072,29 @@ void RenderViewHostImpl::OnRenderProcess
140
RendererExited(render_view_termination_status_, exit_code);
142
delegate_->RenderViewTerminated(this,
143
static_cast<base::TerminationStatus>(status),
147
void RenderViewHostImpl::OnUpdateState(int32 page_id, const PageState& state) {
148
- CHECK_EQ(page_id_, page_id);
149
// Without this check, the renderer can trick the browser into using
150
// filenames it can't access in a future session restore.
151
if (!CanAccessFilesOfPageState(state)) {
152
GetProcess()->ReceivedBadMessage();
156
- delegate_->UpdateState(this, page_id_, state);
157
+ delegate_->UpdateState(this, page_id, state);
160
void RenderViewHostImpl::OnUpdateTargetURL(int32 page_id, const GURL& url) {
161
- CHECK_EQ(page_id_, page_id);
162
if (IsRVHStateActive(rvh_state_))
163
- delegate_->UpdateTargetURL(page_id_, url);
164
+ delegate_->UpdateTargetURL(page_id, url);
166
// Send a notification back to the renderer that we are ready to
167
// receive more target urls.
168
Send(new ViewMsg_UpdateTargetURL_ACK(GetRoutingID()));
171
void RenderViewHostImpl::OnUpdateInspectorSetting(
172
const std::string& key, const std::string& value) {
173
diff --git a/content/browser/renderer_host/render_view_host_impl.h b/content/browser/renderer_host/render_view_host_impl.h
174
--- a/content/browser/renderer_host/render_view_host_impl.h
175
+++ b/content/browser/renderer_host/render_view_host_impl.h
176
@@ -491,21 +491,16 @@ class CONTENT_EXPORT RenderViewHostImpl
178
bool waiting_for_drag_context_response_;
180
// A bitwise OR of bindings types that have been enabled for this RenderView.
181
// See BindingsPolicy for details.
182
int enabled_bindings_;
185
- // The most recent page ID we've heard from the renderer process. This is
186
- // used as context when other session history related IPCs arrive.
187
- // TODO(creis): Allocate this in WebContents/NavigationController instead.
190
// The current state of this RVH.
191
// TODO(nasko): Move to RenderFrameHost, as this is per-frame state.
192
RenderViewHostImplState rvh_state_;
194
// Routing ID for the main frame's RenderFrameHost.
195
int main_frame_routing_id_;
197
// If we were asked to RunModal, then this will hold the reply_msg that we
198
diff --git a/content/browser/renderer_host/render_view_host_unittest.cc b/content/browser/renderer_host/render_view_host_unittest.cc
199
--- a/content/browser/renderer_host/render_view_host_unittest.cc
200
+++ b/content/browser/renderer_host/render_view_host_unittest.cc
201
@@ -209,22 +209,22 @@ TEST_F(RenderViewHostTest, DragEnteredFi
202
EXPECT_FALSE(policy->CanReadFile(id, sensitive_file_path));
205
TEST_F(RenderViewHostTest, MessageWithBadHistoryItemFiles) {
206
base::FilePath file_path;
207
EXPECT_TRUE(PathService::Get(base::DIR_TEMP, &file_path));
208
file_path = file_path.AppendASCII("foo");
209
EXPECT_EQ(0, process()->bad_msg_count());
210
- test_rvh()->TestOnUpdateStateWithFile(-1, file_path);
211
+ test_rvh()->TestOnUpdateStateWithFile(process()->GetID(), file_path);
212
EXPECT_EQ(1, process()->bad_msg_count());
214
ChildProcessSecurityPolicyImpl::GetInstance()->GrantReadFile(
215
process()->GetID(), file_path);
216
- test_rvh()->TestOnUpdateStateWithFile(-1, file_path);
217
+ test_rvh()->TestOnUpdateStateWithFile(process()->GetID(), file_path);
218
EXPECT_EQ(1, process()->bad_msg_count());
221
TEST_F(RenderViewHostTest, NavigationWithBadHistoryItemFiles) {
222
GURL url("http://www.google.com");
223
base::FilePath file_path;
224
EXPECT_TRUE(PathService::Get(base::DIR_TEMP, &file_path));
225
file_path = file_path.AppendASCII("bar");
226
diff --git a/content/test/test_render_view_host.cc b/content/test/test_render_view_host.cc
227
--- a/content/test/test_render_view_host.cc
228
+++ b/content/test/test_render_view_host.cc
229
@@ -341,19 +341,19 @@ void TestRenderViewHost::TestOnStartDrag
230
const DropData& drop_data) {
231
blink::WebDragOperationsMask drag_operation = blink::WebDragOperationEvery;
232
DragEventSourceInfo event_info;
233
OnStartDragging(drop_data, drag_operation, SkBitmap(), gfx::Vector2d(),
237
void TestRenderViewHost::TestOnUpdateStateWithFile(
240
const base::FilePath& file_path) {
241
- OnUpdateState(page_id,
242
+ OnUpdateState(process_id,
243
PageState::CreateForTesting(GURL("http://www.google.com"),
249
void TestRenderViewHost::set_simulate_fetch_via_proxy(bool proxy) {
250
simulate_fetch_via_proxy_ = proxy;
251
diff --git a/content/test/test_render_view_host.h b/content/test/test_render_view_host.h
252
--- a/content/test/test_render_view_host.h
253
+++ b/content/test/test_render_view_host.h
254
@@ -245,17 +245,17 @@ class TestRenderViewHost
256
void SendNavigateWithFile(
257
int page_id, const GURL& url, const base::FilePath& file_path);
259
void SendNavigateWithParams(
260
FrameHostMsg_DidCommitProvisionalLoad_Params* params);
262
void TestOnUpdateStateWithFile(
263
- int page_id, const base::FilePath& file_path);
264
+ int process_id, const base::FilePath& file_path);
266
void TestOnStartDragging(const DropData& drop_data);
268
// If set, *delete_counter is incremented when this object destructs.
269
void set_delete_counter(int* delete_counter) {
270
delete_counter_ = delete_counter;