Skip to content

Commit

Permalink
Fix crash with --load-extension for extensions with plugins
Browse files Browse the repository at this point in the history
Ensure the extension install UI has a profile available to use for image loading, even if the prompt is opened before any browser window are available.

This bug is currently crashing Clusterfuzz ~100 times per hour and polluting the crash statistics.

BUG=344199
TEST=see bug
TBR=miket@chromium.org

Review URL: https://codereview.chromium.org/168823004

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@252077 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
jamescook@chromium.org committed Feb 19, 2014
1 parent 3247264 commit bb2218c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
13 changes: 13 additions & 0 deletions chrome/browser/extensions/unpacked_installer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

#include "base/bind.h"
#include "base/callback.h"
#include "base/command_line.h"
#include "base/file_util.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
Expand All @@ -15,6 +16,7 @@
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/extensions/permissions_updater.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/extensions/api/plugins/plugins_handler.h"
#include "chrome/common/extensions/extension_file_util.h"
#include "chrome/common/extensions/extension_l10n_util.h"
Expand Down Expand Up @@ -68,6 +70,17 @@ SimpleExtensionLoadPrompt::~SimpleExtensionLoadPrompt() {
}

void SimpleExtensionLoadPrompt::ShowPrompt() {
std::string confirm = CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
switches::kAppsGalleryInstallAutoConfirmForTests);
if (confirm == "accept") {
InstallUIProceed();
return;
}
if (confirm == "cancel") {
InstallUIAbort(false);
return;
}

install_ui_->ConfirmInstall(
this,
extension_.get(),
Expand Down
6 changes: 5 additions & 1 deletion chrome/browser/ui/extensions/extension_install_ui_default.cc
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,11 @@ ExtensionInstallPrompt* ExtensionInstallUI::CreateInstallPromptWithProfile(
Profile* profile) {
Browser* browser = chrome::FindLastActiveWithProfile(profile,
chrome::GetActiveDesktop());
return CreateInstallPromptWithBrowser(browser);
if (browser)
return CreateInstallPromptWithBrowser(browser);
// No browser window is open yet. Create a free-standing dialog associated
// with |profile|.
return new ExtensionInstallPrompt(profile, NULL, NULL);
}


Expand Down

0 comments on commit bb2218c

Please sign in to comment.