Chromium Code Reviews| Index: content/renderer/render_frame_impl.cc |
| diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc |
| index 209b20bd42ea3ed1cf75a673d3d1c1ef659e9f85..7d9030107bbaf90a32a07f3b2ed74360426b57b0 100644 |
| --- a/content/renderer/render_frame_impl.cc |
| +++ b/content/renderer/render_frame_impl.cc |
| @@ -2106,7 +2106,6 @@ void RenderFrameImpl::UpdateURL(blink::WebFrame* frame) { |
| DCHECK(ds); |
| const WebURLRequest& request = ds->request(); |
| - const WebURLRequest& original_request = ds->originalRequest(); |
| const WebURLResponse& response = ds->response(); |
| DocumentState* document_state = DocumentState::FromDataSource(ds); |
| @@ -2227,10 +2226,7 @@ void RenderFrameImpl::UpdateURL(blink::WebFrame* frame) { |
| // Track the URL of the original request. We use the first entry of the |
| // redirect chain if it exists because the chain may have started in another |
| // process. |
| - if (params.redirects.size() > 0) |
| - params.original_request_url = params.redirects.at(0); |
| - else |
| - params.original_request_url = original_request.url(); |
| + params.original_request_url = GetOriginalRequestURL(ds); |
| params.history_list_was_cleared = |
| navigation_state->history_list_was_cleared(); |
| @@ -2281,4 +2277,21 @@ void RenderFrameImpl::didStopLoading() { |
| Send(new FrameHostMsg_DidStopLoading(routing_id_)); |
| } |
| +// static |
| +GURL RenderFrameImpl::GetOriginalRequestURL(WebDataSource* ds) { |
|
darin (slow to review)
2014/03/27 08:10:28
Since this method is static, and not called by any
hush (inactive)
2014/03/27 20:15:00
Done.
|
| + // WebDataSource has unreachable URL means that the frame is loaded through |
| + // blink::WebFrame::loadData(), and the base URL will be in the redirect |
| + // chain. However, we never visited the baseURL. So in this case, we should |
| + // use the unreachable URL as the original URL. |
| + if (ds->hasUnreachableURL()) |
| + return ds->unreachableURL(); |
| + |
| + std::vector<GURL> redirects; |
| + GetRedirectChain(ds, &redirects); |
| + if (!redirects.empty()) |
| + return redirects.at(0); |
| + |
| + return ds->originalRequest().url(); |
| +} |
| + |
| } // namespace content |