Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(219)

Unified Diff: content/renderer/render_frame_impl.cc

Issue 1497743005: Allow huge data: URIs only via WebView.loadDataWithBaseUrl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed the test Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/renderer/render_frame_impl.h ('k') | content/renderer/render_view_browsertest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/render_frame_impl.cc
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc
index 9e01406593394ecf970e84632b087772fde715ad..ea397c1ff2bf8d845fef9d76f4bd99ecae3b1a7f 100644
--- a/content/renderer/render_frame_impl.cc
+++ b/content/renderer/render_frame_impl.cc
@@ -16,6 +16,7 @@
#include "base/files/file.h"
#include "base/i18n/char_iterator.h"
#include "base/logging.h"
+#include "base/memory/shared_memory.h"
#include "base/memory/weak_ptr.h"
#include "base/metrics/histogram.h"
#include "base/process/process.h"
@@ -3472,7 +3473,7 @@ void RenderFrameImpl::showContextMenu(const blink::WebContextMenuData& data) {
// in the context menu.
// TODO(jcivelli): http://crbug.com/45160 This prevents us from saving large
// data encoded images. We should have a way to save them.
- if (params.src_url.spec().size() > GetMaxURLChars())
+ if (params.src_url.spec().size() > kMaxURLChars)
params.src_url = GURL();
context_menu_node_ = data.node;
@@ -5072,7 +5073,7 @@ void RenderFrameImpl::NavigateInternal(
if (!common_params.base_url_for_data_url.is_empty() ||
(browser_side_navigation &&
common_params.url.SchemeIs(url::kDataScheme))) {
- LoadDataURL(common_params, frame_, load_type);
+ LoadDataURL(common_params, request_params, frame_, load_type);
} else {
// Load the request.
frame_->toWebLocalFrame()->load(request, load_type,
@@ -5312,11 +5313,28 @@ void RenderFrameImpl::BeginNavigation(blink::WebURLRequest* request) {
}
void RenderFrameImpl::LoadDataURL(const CommonNavigationParams& params,
+ const RequestNavigationParams& request_params,
WebFrame* frame,
blink::WebFrameLoadType load_type) {
// A loadData request with a specified base URL.
+ GURL data_url = params.url;
+#if defined(OS_ANDROID)
+ if (!request_params.data_url_as_string.empty()) {
+#if DCHECK_IS_ON()
+ {
+ std::string mime_type, charset, data;
+ DCHECK(net::DataURL::Parse(data_url, &mime_type, &charset, &data));
+ DCHECK(data.empty());
+ }
+#endif
+ data_url = GURL(request_params.data_url_as_string);
+ if (!data_url.is_valid() || !data_url.SchemeIs(url::kDataScheme)) {
+ data_url = params.url;
+ }
+ }
+#endif
std::string mime_type, charset, data;
- if (net::DataURL::Parse(params.url, &mime_type, &charset, &data)) {
+ if (net::DataURL::Parse(data_url, &mime_type, &charset, &data)) {
const GURL base_url = params.base_url_for_data_url.is_empty() ?
params.url : params.base_url_for_data_url;
bool replace = load_type == blink::WebFrameLoadType::ReloadFromOrigin ||
« no previous file with comments | « content/renderer/render_frame_impl.h ('k') | content/renderer/render_view_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698