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 3d04fffdb1718be87006d90a4ec0c65a4351d1f2..ae86e4658b6a2234ef72cdf783bbe697dc4a3505 100644 |
| --- a/content/renderer/render_frame_impl.cc |
| +++ b/content/renderer/render_frame_impl.cc |
| @@ -1092,22 +1092,8 @@ void RenderFrameImpl::OnNavigate(const FrameMsg_Navigate_Params& params) { |
| CHECK(entry->root().urlString() != WebString::fromUTF8(kSwappedOutURL)); |
| render_view_->history_controller()->GoToEntry(entry.Pass(), cache_policy); |
| } |
| - } 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.common_params.url, &mime_type, &charset, &data)) { |
| - frame->loadData( |
| - WebData(data.c_str(), data.length()), |
| - WebString::fromUTF8(mime_type), |
| - WebString::fromUTF8(charset), |
| - params.base_url_for_data_url, |
| - params.history_url_for_data_url, |
| - false); |
| - } else { |
| - CHECK(false) << "Invalid URL passed: " |
| - << params.common_params.url.possibly_invalid_spec(); |
| - } |
| + } else if (!params.common_params.base_url_for_data_url.is_empty()) { |
| + LoadDataURL(params.common_params, frame); |
| } else { |
| // Navigate to the given URL. |
| WebURLRequest request = |
| @@ -3882,6 +3868,12 @@ void RenderFrameImpl::OnCommitNavigation( |
| GetContentClient()->SetActiveURL(common_params.url); |
| + if (!common_params.base_url_for_data_url.is_empty() || |
| + common_params.url.SchemeIs(url::kDataScheme)) { |
| + LoadDataURL(common_params, frame_); |
| + return; |
| + } |
| + |
| // Create a WebURLRequest that blink can use to get access to the body of the |
| // response through a stream in the browser. Blink will then commit the |
| // navigation. |
| @@ -4377,6 +4369,26 @@ void RenderFrameImpl::BeginNavigation(blink::WebURLRequest* request) { |
| GetRequestBodyForWebURLRequest(*request))); |
| } |
| +void RenderFrameImpl::LoadDataURL(const CommonNavigationParams& params, |
| + WebFrame* frame) { |
| + // A loadData request with a specified base URL. |
| + std::string mime_type, charset, data; |
| + if (net::DataURL::Parse(params.url, &mime_type, &charset, &data)) { |
| + const GURL base_url = params.base_url_for_data_url.is_empty() ? |
|
Charlie Reis
2015/02/20 22:11:50
We didn't have this case before (i.e., passing a d
clamy
2015/02/26 15:28:36
We cannot pass an empty URL here as this will caus
|
| + params.url : params.base_url_for_data_url; |
| + frame->loadData( |
| + WebData(data.c_str(), data.length()), |
| + WebString::fromUTF8(mime_type), |
| + WebString::fromUTF8(charset), |
| + base_url, |
| + params.history_url_for_data_url, |
| + false); |
| + } else { |
| + CHECK(false) << "Invalid URL passed: " |
| + << params.url.possibly_invalid_spec(); |
| + } |
| +} |
| + |
| GURL RenderFrameImpl::GetLoadingUrl() const { |
| WebDataSource* ds = frame_->dataSource(); |
| if (ds->hasUnreachableURL()) |