Skip to content
This repository has been archived by the owner on Jan 4, 2019. It is now read-only.

Commit

Permalink
don't try to initialize the autofill database until the user data dir…
Browse files Browse the repository at this point in the history
… has been created for this context

auditors: @bbondy, @darkdh
fixes brave/browser-laptop#3577
  • Loading branch information
bridiver committed Sep 16, 2016
1 parent e6cffd6 commit b2f92f7
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions brave/browser/brave_browser_context.cc
Original file line number Diff line number Diff line change
Expand Up @@ -100,23 +100,6 @@ BraveBrowserContext::BraveBrowserContext(const std::string& partition,
base::Unretained(original_context_),
base::Unretained(this)));
#endif
} else {
// Initialize autofill db
base::FilePath webDataPath = GetPath().Append(kWebDataFilename);

CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
web_database_ = new WebDatabaseService(webDataPath,
BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI),
BrowserThread::GetMessageLoopProxyForThread(BrowserThread::DB));
web_database_->AddTable(base::WrapUnique(new autofill::AutofillTable));
web_database_->LoadDatabase();

autofill_data_ = new autofill::AutofillWebDataService(
web_database_,
BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI),
BrowserThread::GetMessageLoopProxyForThread(BrowserThread::DB),
base::Bind(&DatabaseErrorCallback));
autofill_data_->Init();
}
}

Expand Down Expand Up @@ -363,6 +346,23 @@ void BraveBrowserContext::OnPrefsLoaded(bool success) {
#endif
content::BrowserContext::GetDefaultStoragePartition(this)->
GetDOMStorageContext()->SetSaveSessionStorageOnDisk();

// Initialize autofill db
base::FilePath webDataPath = GetPath().Append(kWebDataFilename);

CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
web_database_ = new WebDatabaseService(webDataPath,
BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI),
BrowserThread::GetMessageLoopProxyForThread(BrowserThread::DB));
web_database_->AddTable(base::WrapUnique(new autofill::AutofillTable));
web_database_->LoadDatabase();

autofill_data_ = new autofill::AutofillWebDataService(
web_database_,
BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI),
BrowserThread::GetMessageLoopProxyForThread(BrowserThread::DB),
base::Bind(&DatabaseErrorCallback));
autofill_data_->Init();
}

user_prefs_registrar_->Init(user_prefs_.get());
Expand Down

0 comments on commit b2f92f7

Please sign in to comment.