зеркало из https://github.com/mozilla/gecko-dev.git
Bug 744668 - Control URI access NPE if Fennec not yet launched. r=lucasr
This commit is contained in:
Родитель
c20237d25f
Коммит
88a2619d54
|
@ -2270,7 +2270,7 @@ abstract public class GeckoApp
|
|||
Log.i(LOGTAG, "checking profile migration in: " + profileDir.getAbsolutePath());
|
||||
final GeckoApp app = GeckoApp.mAppContext;
|
||||
ProfileMigrator profileMigrator =
|
||||
new ProfileMigrator(app.getContentResolver(), profileDir);
|
||||
new ProfileMigrator(app, profileDir);
|
||||
|
||||
// Do a migration run on the first start after an upgrade.
|
||||
if (!profileMigrator.hasMigrationRun()) {
|
||||
|
|
|
@ -88,6 +88,7 @@ public class ProfileMigrator {
|
|||
private static final String PREFS_NAME = "ProfileMigrator";
|
||||
private File mProfileDir;
|
||||
private ContentResolver mCr;
|
||||
private Context mContext;
|
||||
|
||||
// Default number of history entries to migrate in one run.
|
||||
private static final int DEFAULT_HISTORY_MIGRATE_COUNT = 2000;
|
||||
|
@ -192,9 +193,10 @@ public class ProfileMigrator {
|
|||
private final String kHistoryDate = "h_date";
|
||||
private final String kHistoryVisits = "h_visits";
|
||||
|
||||
public ProfileMigrator(ContentResolver cr, File profileDir) {
|
||||
public ProfileMigrator(Context context, File profileDir) {
|
||||
mProfileDir = profileDir;
|
||||
mCr = cr;
|
||||
mContext = context;
|
||||
mCr = mContext.getContentResolver();
|
||||
}
|
||||
|
||||
public void launch() {
|
||||
|
@ -224,7 +226,7 @@ public class ProfileMigrator {
|
|||
}
|
||||
|
||||
protected SharedPreferences getPreferences() {
|
||||
return GeckoApp.mAppContext.getSharedPreferences(PREFS_NAME, 0);
|
||||
return mContext.getSharedPreferences(PREFS_NAME, 0);
|
||||
}
|
||||
|
||||
protected int getMigratedHistoryEntries() {
|
||||
|
@ -810,7 +812,7 @@ public class ProfileMigrator {
|
|||
File dbFileShm = new File(dbPathShm);
|
||||
|
||||
SQLiteBridge db = null;
|
||||
GeckoAppShell.loadSQLiteLibs(GeckoApp.mAppContext, GeckoApp.mAppContext.getApplication().getPackageResourcePath());
|
||||
GeckoAppShell.loadSQLiteLibs(mContext, mContext.getPackageResourcePath());
|
||||
try {
|
||||
db = new SQLiteBridge(dbPath);
|
||||
calculateReroot(db);
|
||||
|
@ -851,7 +853,7 @@ public class ProfileMigrator {
|
|||
}
|
||||
|
||||
protected void cleanupXULLibCache() {
|
||||
File cacheFile = GeckoAppShell.getCacheDir(GeckoApp.mAppContext);
|
||||
File cacheFile = GeckoAppShell.getCacheDir(mContext);
|
||||
File[] files = cacheFile.listFiles();
|
||||
if (files != null) {
|
||||
Iterator<File> cacheFiles = Arrays.asList(files).iterator();
|
||||
|
|
|
@ -1491,7 +1491,7 @@ public class BrowserProvider extends ContentProvider {
|
|||
|
||||
if (wantHistory || wantBookmarks) {
|
||||
ProfileMigrator migrator =
|
||||
new ProfileMigrator(mContext.getContentResolver(), profileDir);
|
||||
new ProfileMigrator(mContext, profileDir);
|
||||
|
||||
boolean needBookmarks = wantBookmarks && !migrator.areBookmarksMigrated();
|
||||
boolean needHistory = wantHistory && !migrator.isHistoryMigrated();
|
||||
|
|
Загрузка…
Ссылка в новой задаче