mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 784759 - Delay database initialization until after first page load. r=mfinkle
This commit is contained in:
parent
a81fc18792
commit
b9e1724d63
@ -90,6 +90,16 @@ abstract class BaseTest extends ActivityInstrumentationTestCase2<Activity> {
|
||||
}
|
||||
}
|
||||
|
||||
protected void blockForGeckoDelayedStartup() {
|
||||
try {
|
||||
Actions.EventExpecter geckoReadyExpector = mActions.expectGeckoEvent("Gecko:DelayedStartup");
|
||||
geckoReadyExpector.blockForEvent();
|
||||
geckoReadyExpector.unregisterListener();
|
||||
} catch (Exception e) {
|
||||
mAsserter.dumpLog("Exception in blockForGeckoDelayedStartup", e);
|
||||
}
|
||||
}
|
||||
|
||||
static {
|
||||
try {
|
||||
mLauncherActivityClass = (Class<Activity>)Class.forName(LAUNCH_ACTIVITY_FULL_CLASSNAME);
|
||||
|
@ -29,7 +29,7 @@ public class testFormHistory extends BaseTest {
|
||||
ContentValues[] cvs = new ContentValues[1];
|
||||
cvs[0] = new ContentValues();
|
||||
|
||||
blockForGeckoReady();
|
||||
blockForGeckoDelayedStartup();
|
||||
|
||||
Uri formHistoryUri;
|
||||
Uri insertUri;
|
||||
|
@ -30,7 +30,7 @@ public class testPasswordProvider extends BaseTest {
|
||||
ContentValues[] cvs = new ContentValues[1];
|
||||
cvs[0] = new ContentValues();
|
||||
|
||||
blockForGeckoReady();
|
||||
blockForGeckoDelayedStartup();
|
||||
|
||||
cvs[0].put("hostname", "http://www.example.com");
|
||||
cvs[0].put("httpRealm", "http://www.example.com");
|
||||
|
@ -423,6 +423,8 @@ var BrowserApp = {
|
||||
event.initEvent("UIReady", true, false);
|
||||
window.dispatchEvent(event);
|
||||
|
||||
Services.obs.addObserver(this, "browser-delayed-startup-finished", false);
|
||||
|
||||
if (this._startupStatus)
|
||||
this.onAppUpdated();
|
||||
|
||||
@ -694,10 +696,6 @@ var BrowserApp = {
|
||||
},
|
||||
|
||||
onAppUpdated: function() {
|
||||
// initialize the form history and passwords databases on upgrades
|
||||
Services.obs.notifyObservers(null, "FormHistory:Init", "");
|
||||
Services.obs.notifyObservers(null, "Passwords:Init", "");
|
||||
|
||||
// Migrate user-set "plugins.click_to_play" pref. See bug 884694.
|
||||
// Because the default value is true, a user-set pref means that the pref was set to false.
|
||||
if (Services.prefs.prefHasUserValue("plugins.click_to_play")) {
|
||||
@ -1614,6 +1612,10 @@ var BrowserApp = {
|
||||
Services.prefs.setCharPref("general.useragent.locale", aData);
|
||||
break;
|
||||
|
||||
case "browser-delayed-startup-finished":
|
||||
this._delayedStartup();
|
||||
break;
|
||||
|
||||
default:
|
||||
dump('BrowserApp.observe: unexpected topic "' + aTopic + '"\n');
|
||||
break;
|
||||
@ -1621,6 +1623,14 @@ var BrowserApp = {
|
||||
}
|
||||
},
|
||||
|
||||
_delayedStartup: function() {
|
||||
// initialize the form history and passwords databases on upgrades
|
||||
if (this._startupStatus) {
|
||||
Services.obs.notifyObservers(null, "FormHistory:Init", "");
|
||||
Services.obs.notifyObservers(null, "Passwords:Init", "");
|
||||
}
|
||||
},
|
||||
|
||||
get defaultBrowserWidth() {
|
||||
delete this.defaultBrowserWidth;
|
||||
let width = Services.prefs.getIntPref("browser.viewport.desktopWidth");
|
||||
|
Loading…
Reference in New Issue
Block a user