diff options
author | boliu <boliu@chromium.org> | 2015-11-24 15:08:05 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-11-24 23:09:45 +0000 |
commit | 15890e4b345bfef3854566899a0a462f7c5939a9 (patch) | |
tree | 095f24b946c12cb4dec34f6e0dbf722dd19079ac /extensions/browser/guest_view | |
parent | bbc852ea41740d51946ffbfb24dc1c4e51385172 (diff) | |
download | chromium_src-15890e4b345bfef3854566899a0a462f7c5939a9.zip chromium_src-15890e4b345bfef3854566899a0a462f7c5939a9.tar.gz chromium_src-15890e4b345bfef3854566899a0a462f7c5939a9.tar.bz2 |
Fix LoadDataWithBaseURL reload
On a LoadDataWithBaseURL, renderer reports the history URL
as the URL of the navigation, and is stored in the
NavigationEntry::GetURL field, overwriting the data URL
originally stored there. This causes a crash on a reload
since the data URL has been lost.
Fix this by saving the data URL DocumentState so that
renderer can return it as the URL of the load. This means
that GetURL and GetOriginalURL for a LoadDataWithBaseURL
will now return the data URL, not the history URL.
Also fix WebFrame::LoadData to not create new navigation
for a reload.
BUG=522567
Review URL: https://codereview.chromium.org/1304373007
Cr-Commit-Position: refs/heads/master@{#361481}
Diffstat (limited to 'extensions/browser/guest_view')
-rw-r--r-- | extensions/browser/guest_view/web_view/web_view_guest.cc | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/extensions/browser/guest_view/web_view/web_view_guest.cc b/extensions/browser/guest_view/web_view/web_view_guest.cc index 1715b35..ce1d3d5 100644 --- a/extensions/browser/guest_view/web_view/web_view_guest.cc +++ b/extensions/browser/guest_view/web_view/web_view_guest.cc @@ -789,7 +789,9 @@ void WebViewGuest::DidCommitProvisionalLoadForFrame( const GURL& url, ui::PageTransition transition_type) { if (!render_frame_host->GetParent()) { - src_ = url; + // For LoadDataWithBaseURL loads, |url| contains the data URL, but the + // virtual URL is needed in that case. So use WebContents::GetURL instead. + src_ = web_contents()->GetURL(); // Handle a pending zoom if one exists. if (pending_zoom_factor_) { SetZoom(pending_zoom_factor_); @@ -797,7 +799,7 @@ void WebViewGuest::DidCommitProvisionalLoadForFrame( } } scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue()); - args->SetString(guest_view::kUrl, url.spec()); + args->SetString(guest_view::kUrl, src_.spec()); args->SetBoolean(guest_view::kIsTopLevel, !render_frame_host->GetParent()); args->SetString(webview::kInternalBaseURLForDataURL, web_contents() |