summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormkwst@chromium.org <mkwst@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-08 17:46:05 +0000
committermkwst@chromium.org <mkwst@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-08 17:46:05 +0000
commitd477042b137136b9d5f414236b1385737167ce58 (patch)
tree8796aa277fc2dc756975aae0bbe4eb894ec71a90
parentc429bf3a52e14b26493eb19117a85b33537adf0b (diff)
downloadchromium_src-d477042b137136b9d5f414236b1385737167ce58.zip
chromium_src-d477042b137136b9d5f414236b1385737167ce58.tar.gz
chromium_src-d477042b137136b9d5f414236b1385737167ce58.tar.bz2
Deal correctly with BrowsingData API calls during startup.
We're apparently running into situations where an extension is attempting to clear browsing data before either the browser or the profile is correctly set up. This CL takes the simplest approach: if we can't grab the browser or the profile, exit early (hopefully) without crashing. BUG=139075 Review URL: https://chromiumcodereview.appspot.com/10855049 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@150583 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/extensions/api/browsing_data/browsing_data_api.cc10
1 files changed, 6 insertions, 4 deletions
diff --git a/chrome/browser/extensions/api/browsing_data/browsing_data_api.cc b/chrome/browser/extensions/api/browsing_data/browsing_data_api.cc
index afdb914..f1a706b 100644
--- a/chrome/browser/extensions/api/browsing_data/browsing_data_api.cc
+++ b/chrome/browser/extensions/api/browsing_data/browsing_data_api.cc
@@ -116,6 +116,9 @@ void BrowsingDataExtensionFunction::OnBrowsingDataRemoverDone() {
}
bool BrowsingDataExtensionFunction::RunImpl() {
+ // If we don't have a profile, something's pretty wrong.
+ DCHECK(profile());
+
if (BrowsingDataRemover::is_removing()) {
error_ = extension_browsing_data_api_constants::kOneAtATimeError;
return false;
@@ -147,13 +150,12 @@ bool BrowsingDataExtensionFunction::RunImpl() {
if (removal_mask_ & BrowsingDataRemover::REMOVE_PLUGIN_DATA) {
// If we're being asked to remove plugin data, check whether it's actually
// supported.
- Profile* profile = GetCurrentBrowser()->profile();
BrowserThread::PostTask(
BrowserThread::FILE, FROM_HERE,
base::Bind(
&BrowsingDataExtensionFunction::CheckRemovingPluginDataSupported,
this,
- PluginPrefs::GetForProfile(profile)));
+ PluginPrefs::GetForProfile(profile())));
} else {
StartRemoving();
}
@@ -180,8 +182,8 @@ void BrowsingDataExtensionFunction::StartRemoving() {
// that we're notified after removal) and call remove() with the arguments
// we've generated above. We can use a raw pointer here, as the browsing data
// remover is responsible for deleting itself once data removal is complete.
- BrowsingDataRemover* remover = new BrowsingDataRemover(
- GetCurrentBrowser()->profile(), remove_since_, base::Time::Now());
+ BrowsingDataRemover* remover = new BrowsingDataRemover(profile(),
+ remove_since_, base::Time::Now());
remover->AddObserver(this);
remover->Remove(removal_mask_, origin_set_mask_);
}