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

Unified Diff: chrome/browser/extensions/webstore_installer.cc

Issue 10453039: Debug crash in WebstoreInstaller::StartDownload() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge Created 8 years, 6 months 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/webstore_installer.cc
diff --git a/chrome/browser/extensions/webstore_installer.cc b/chrome/browser/extensions/webstore_installer.cc
index 06232ea934f9f810178418ae3f4d4da716878aa5..4d613b2b03327672ca989fc5bd412e3f71ec4a06 100644
--- a/chrome/browser/extensions/webstore_installer.cc
+++ b/chrome/browser/extensions/webstore_installer.cc
@@ -172,6 +172,8 @@ WebstoreInstaller::WebstoreInstaller(Profile* profile,
download_item_(NULL),
flags_(flags),
approval_(approval.release()) {
+ // TODO(benjhayden): Change this CHECK to DCHECK after http://crbug.com/126013
+ CHECK(controller_);
download_url_ = GetWebstoreInstallURL(id, flags & FLAG_INLINE_INSTALL ?
kInlineInstallSource : kDefaultInstallSource);
@@ -197,9 +199,7 @@ void WebstoreInstaller::Start() {
BrowserThread::PostTask(
BrowserThread::FILE, FROM_HERE,
base::Bind(&GetDownloadFilePath, download_path, id_,
- base::Bind(&WebstoreInstaller::StartDownload,
- base::Unretained(this))));
-
+ base::Bind(&WebstoreInstaller::StartDownload, this)));
}
void WebstoreInstaller::Observe(int type,
@@ -306,7 +306,7 @@ void WebstoreInstaller::OnDownloadOpened(DownloadItem* download) {
void WebstoreInstaller::StartDownload(const FilePath& file) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- if (file.empty()) {
+ if (file.empty() || !controller_->GetWebContents()) {
ReportFailure(kDownloadDirectoryError);
return;
}
@@ -322,9 +322,10 @@ void WebstoreInstaller::StartDownload(const FilePath& file) {
scoped_ptr<DownloadUrlParameters> params(
DownloadUrlParameters::FromWebContents(
controller_->GetWebContents(), download_url_, save_info));
- params->set_referrer(
- content::Referrer(controller_->GetActiveEntry()->GetURL(),
- WebKit::WebReferrerPolicyDefault));
+ if (controller_->GetActiveEntry())
+ params->set_referrer(
+ content::Referrer(controller_->GetActiveEntry()->GetURL(),
+ WebKit::WebReferrerPolicyDefault));
params->set_callback(base::Bind(&WebstoreInstaller::OnDownloadStarted, this));
BrowserContext::GetDownloadManager(profile_)->DownloadUrl(params.Pass());
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698