Bug 959396 - Init WindowsPrefSync sooner and populate _orderedWindows even when not restoring. r=tabraldes

This commit is contained in:
Marina Samuel 2014-01-23 13:34:27 -08:00
parent 1efc7fa24c
commit 72347ed5ba
3 changed files with 11 additions and 9 deletions

View File

@ -161,11 +161,6 @@ var BrowserUI = {
Util.dumpLn("Exception in delay load module:", ex.message);
}
if (WindowsPrefSync) {
// Pulls in Desktop controlled prefs and pushes out Metro controlled prefs
WindowsPrefSync.init();
}
// check for left over crash reports and submit them if found.
BrowserUI.startupCrashCheck();

View File

@ -185,8 +185,7 @@ var Browser = {
// Should we restore the previous session (crash or some other event)
let ss = Cc["@mozilla.org/browser/sessionstore;1"]
.getService(Ci.nsISessionStore);
let shouldRestore = ss.shouldRestore()
|| (3 == Services.prefs.getIntPref("browser.startup.page"));
let shouldRestore = ss.shouldRestore();
if (shouldRestore) {
let bringFront = false;
// First open any commandline URLs, except the homepage

View File

@ -9,6 +9,7 @@ const Cr = Components.results;
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/WindowsPrefSync.jsm");
#ifdef MOZ_CRASHREPORTER
XPCOMUtils.defineLazyServiceGetter(this, "CrashReporter",
@ -199,6 +200,10 @@ SessionStore.prototype = {
break;
case "final-ui-startup":
observerService.removeObserver(this, "final-ui-startup");
if (WindowsPrefSync) {
// Pulls in Desktop controlled prefs and pushes out Metro controlled prefs
WindowsPrefSync.init();
}
this.init();
break;
case "domwindowopened":
@ -340,9 +345,12 @@ SessionStore.prototype = {
this._lastSaveTime = Date.now();
// Nothing to restore, notify observers things are complete
if (!this._shouldRestore) {
if (!this.shouldRestore()) {
this._clearCache();
Services.obs.notifyObservers(null, "sessionstore-windows-restored", "");
// If nothing is being restored, we only have our single Metro window.
this._orderedWindows.push(aWindow.__SSID);
}
}
@ -726,7 +734,7 @@ SessionStore.prototype = {
},
shouldRestore: function ss_shouldRestore() {
return this._shouldRestore;
return this._shouldRestore || (3 == Services.prefs.getIntPref("browser.startup.page"));
},
restoreLastSession: function ss_restoreLastSession(aBringToFront) {