summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortony@chromium.org <tony@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-02 01:14:02 +0000
committertony@chromium.org <tony@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-02 01:14:02 +0000
commit5bbe884f693a4cf926cfb3792e4f86dfb5240e17 (patch)
tree0c5c912779ca0dd205bc447e2ff2cf3bae02a02a
parent1cb31cf66284777dc5526773eebaadf24c48080a (diff)
downloadchromium_src-5bbe884f693a4cf926cfb3792e4f86dfb5240e17.zip
chromium_src-5bbe884f693a4cf926cfb3792e4f86dfb5240e17.tar.gz
chromium_src-5bbe884f693a4cf926cfb3792e4f86dfb5240e17.tar.bz2
Modified SavePackage(TabContents* tab_contents) of save_package.cc.
Used the same fix provided for issue 12748. This is done to retrieve actual url of the web page displayed in tab instead of displayed url. Displayed url is different from actual url when viewing source of a web page. ex: view-source:http://www.google.lk/ This is the reason why chrome fails to save source of web page. BUG = 23584 TEST= Visit a web page. Right click and select "view page source". Right click and select Save as. Select web page complete in save dialog. Click save. Source is saved without being cancelled. Repeat the above steps, but select web page only instead of complete in save dialog. Source is saved without chrome getting crashed. Review URL: http://codereview.chromium.org/660264 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@40338 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--AUTHORS1
-rw-r--r--chrome/browser/download/save_package.cc10
2 files changed, 10 insertions, 1 deletions
diff --git a/AUTHORS b/AUTHORS
index cfd4cde..30c1c0f 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -66,3 +66,4 @@ Mark Hahnenberg <mhahnenb@gmail.com>
Alex Gartrell <alexgartrell@gmail.com>
James Choi <jchoi42@pha.jhu.edu>
Paul Kehrer <paul.l.kehrer@gmail.com>
+Chamal De Silva <chamal.desilva@gmail.com>
diff --git a/chrome/browser/download/save_package.cc b/chrome/browser/download/save_package.cc
index 5c089ac..4f5c780 100644
--- a/chrome/browser/download/save_package.cc
+++ b/chrome/browser/download/save_package.cc
@@ -190,7 +190,15 @@ SavePackage::SavePackage(TabContents* tab_contents)
wait_state_(INITIALIZE),
tab_id_(tab_contents->GetRenderProcessHost()->id()),
ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)) {
- const GURL& current_page_url = tab_contents_->GetURL();
+
+ // Instead of using tab_contents_.GetURL here, we use url()
+ // (which is the "real" url of the page)
+ // from the NavigationEntry because its reflects their origin
+ // rather than the displayed one (returned by GetURL) which may be
+ // different (like having "view-source:" on the front).
+ NavigationEntry* active_entry =
+ tab_contents_->controller().GetActiveEntry();
+ const GURL& current_page_url = active_entry->url();
DCHECK(current_page_url.is_valid());
page_url_ = current_page_url;
InternalInit();