Chromium Code Reviews| Index: content/renderer/render_view_impl.cc |
| diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc |
| index 27954584dafce499c41ee8b697137e7d099287c6..9474343e7761b311200ba2249a370a6f94adef7a 100644 |
| --- a/content/renderer/render_view_impl.cc |
| +++ b/content/renderer/render_view_impl.cc |
| @@ -1132,8 +1132,15 @@ void RenderViewImpl::OnNavigate(const ViewMsg_Navigate_Params& params) { |
| GetContentClient()->SetActiveURL(params.url); |
| - WebFrame* main_frame = webview()->mainFrame(); |
| - if (is_reload && main_frame->currentHistoryItem().isNull()) { |
| + WebFrame* frame = webview()->mainFrame(); |
| + if (!params.frame_to_navigate.empty()) { |
| + frame = webview()->findFrameByName( |
| + WebString::fromUTF8(params.frame_to_navigate)); |
| + if (!frame) |
| + return; |
|
Charlie Reis
2013/01/23 01:38:45
Is there any way to trigger a navigation error ins
jochen (gone - plz use gerrit)
2013/01/23 08:22:42
There is no code path to report an error back. If
Charlie Reis
2013/01/23 18:38:17
Ok, since it's just for tests, that seems like it
|
| + } |
| + |
| + if (is_reload && frame->currentHistoryItem().isNull()) { |
| // We cannot reload if we do not have any history state. This happens, for |
| // example, when recovering from a crash. Our workaround here is a bit of |
| // a hack since it means that reload after a crashed tab does not cause an |
| @@ -1155,9 +1162,9 @@ void RenderViewImpl::OnNavigate(const ViewMsg_Navigate_Params& params) { |
| ViewMsg_Navigate_Type::RELOAD_IGNORING_CACHE); |
| if (reload_original_url) |
| - main_frame->reloadWithOverrideURL(params.url, true); |
| + frame->reloadWithOverrideURL(params.url, true); |
| else |
| - main_frame->reload(ignore_cache); |
| + frame->reload(ignore_cache); |
| } else if (!params.state.empty()) { |
| // We must know the page ID of the page we are navigating back to. |
| DCHECK_NE(params.page_id, -1); |
| @@ -1166,13 +1173,13 @@ void RenderViewImpl::OnNavigate(const ViewMsg_Navigate_Params& params) { |
| // Ensure we didn't save the swapped out URL in UpdateState, since the |
| // browser should never be telling us to navigate to swappedout://. |
| CHECK(item.urlString() != WebString::fromUTF8(kSwappedOutURL)); |
| - main_frame->loadHistoryItem(item); |
| + frame->loadHistoryItem(item); |
| } |
| } else if (!params.base_url_for_data_url.is_empty()) { |
| // A loadData request with a specified base URL. |
| std::string mime_type, charset, data; |
| if (net::DataURL::Parse(params.url, &mime_type, &charset, &data)) { |
| - main_frame->loadData( |
| + frame->loadData( |
| WebData(data.c_str(), data.length()), |
| WebString::fromUTF8(mime_type), |
| WebString::fromUTF8(charset), |
| @@ -1190,7 +1197,7 @@ void RenderViewImpl::OnNavigate(const ViewMsg_Navigate_Params& params) { |
| // A session history navigation should have been accompanied by state. |
| CHECK_EQ(params.page_id, -1); |
| - if (main_frame->isViewSourceModeEnabled()) |
| + if (frame->isViewSourceModeEnabled()) |
|
Charlie Reis
2013/01/23 01:38:45
Do subframes return true here when the main frame
jochen (gone - plz use gerrit)
2013/01/23 08:22:42
a view-source page can't have frames
|
| request.setCachePolicy(WebURLRequest::ReturnCacheDataElseLoad); |
| if (params.referrer.url.is_valid()) { |
| @@ -1224,7 +1231,7 @@ void RenderViewImpl::OnNavigate(const ViewMsg_Navigate_Params& params) { |
| request.setHTTPBody(http_body); |
| } |
| - main_frame->loadRequest(request); |
| + frame->loadRequest(request); |
| } |
| // In case LoadRequest failed before DidCreateDataSource was called. |