Bug 1369456 - Replace nsSessionStartup.js with SessionStartup.jsm. r=florian

MozReview-Commit-ID: 53Mu4zb9X1C

--HG--
rename : browser/components/sessionstore/nsSessionStartup.js => browser/components/sessionstore/SessionStartup.jsm
extra : rebase_source : 5b4f5c2e45841a5ee9123386e8657d8c262ba416
This commit is contained in:
Dão Gottwald 2018-08-04 13:27:40 +02:00
Родитель 8dbf61da1e
Коммит 5b4e355993
17 изменённых файлов: 66 добавлений и 186 удалений

Просмотреть файл

@ -53,6 +53,7 @@ XPCOMUtils.defineLazyModuleGetters(this, {
ReaderParent: "resource:///modules/ReaderParent.jsm",
SafeBrowsing: "resource://gre/modules/SafeBrowsing.jsm",
Sanitizer: "resource:///modules/Sanitizer.jsm",
SessionStartup: "resource:///modules/sessionstore/SessionStartup.jsm",
SessionStore: "resource:///modules/sessionstore/SessionStore.jsm",
SchedulePressure: "resource:///modules/SchedulePressure.jsm",
ShortcutUtils: "resource://gre/modules/ShortcutUtils.jsm",
@ -141,7 +142,6 @@ XPCOMUtils.defineLazyServiceGetters(this, {
gDNSService: ["@mozilla.org/network/dns-service;1", "nsIDNSService"],
gSerializationHelper: ["@mozilla.org/network/serialization-helper;1", "nsISerializationHelper"],
Marionette: ["@mozilla.org/remote/marionette;1", "nsIMarionette"],
SessionStartup: ["@mozilla.org/browser/sessionstartup;1", "nsISessionStartup"],
WindowsUIUtils: ["@mozilla.org/windows-ui-utils;1", "nsIWindowsUIUtils"],
});

Просмотреть файл

@ -31,7 +31,6 @@ const startupPhases = {
"MainProcessSingleton.js",
// Bugs to fix: The following components shouldn't be initialized that early.
"nsSessionStartup.js", // bug 1369456
"PushComponents.js", // bug 1369436
]),
modules: new Set([

Просмотреть файл

@ -12,6 +12,7 @@ XPCOMUtils.defineLazyModuleGetters(this, {
HomePage: "resource:///modules/HomePage.jsm",
LaterRun: "resource:///modules/LaterRun.jsm",
PrivateBrowsingUtils: "resource://gre/modules/PrivateBrowsingUtils.jsm",
SessionStartup: "resource:///modules/sessionstore/SessionStartup.jsm",
ShellService: "resource:///modules/ShellService.jsm",
UpdatePing: "resource://gre/modules/UpdatePing.jsm"
});
@ -510,9 +511,7 @@ nsBrowserContentHandler.prototype = {
// into account because that requires waiting for the session file
// to be read. If a crash occurs after updating, before restarting,
// we may open the startPage in addition to restoring the session.
var ss = Cc["@mozilla.org/browser/sessionstartup;1"]
.getService(Ci.nsISessionStartup);
willRestoreSession = ss.isAutomaticRestoreEnabled();
willRestoreSession = SessionStartup.isAutomaticRestoreEnabled();
overridePage = Services.urlFormatter.formatURLPref("startup.homepage_override_url");
if (prefb.prefHasUserValue("app.update.postupdate")) {

Просмотреть файл

@ -132,6 +132,7 @@ XPCOMUtils.defineLazyModuleGetters(this, {
SafeBrowsing: "resource://gre/modules/SafeBrowsing.jsm",
Sanitizer: "resource:///modules/Sanitizer.jsm",
SavantShieldStudy: "resource:///modules/SavantShieldStudy.jsm",
SessionStartup: "resource:///modules/sessionstore/SessionStartup.jsm",
SessionStore: "resource:///modules/sessionstore/SessionStore.jsm",
ShellService: "resource:///modules/ShellService.jsm",
TabCrashHandler: "resource:///modules/ContentCrashHandlers.jsm",
@ -702,6 +703,8 @@ BrowserGlue.prototype = {
// runs on startup, before the first command line handler is invoked
// (i.e. before the first window is opened)
_beforeUIStartup: function BG__beforeUIStartup() {
SessionStartup.init();
// check if we're in safe mode
if (Services.appinfo.inSafeMode) {
Services.ww.openWindow(null, "chrome://browser/content/safeMode.xul",
@ -2160,13 +2163,8 @@ BrowserGlue.prototype = {
let promptCount =
usePromptLimit ? Services.prefs.getIntPref("browser.shell.defaultBrowserCheckCount") : 0;
let willRecoverSession = false;
try {
let ss = Cc["@mozilla.org/browser/sessionstartup;1"].
getService(Ci.nsISessionStartup);
willRecoverSession =
(ss.sessionType == Ci.nsISessionStartup.RECOVER_SESSION);
} catch (ex) { /* never mind; suppose SessionStore is broken */ }
let willRecoverSession =
(SessionStartup.sessionType == SessionStartup.RECOVER_SESSION);
// startup check, check all assoc
let isDefault = false;

Просмотреть файл

@ -30,16 +30,15 @@ ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
ChromeUtils.import("resource://gre/modules/osfile.jsm");
ChromeUtils.import("resource://gre/modules/AsyncShutdown.jsm");
ChromeUtils.defineModuleGetter(this, "RunState",
"resource:///modules/sessionstore/RunState.jsm");
XPCOMUtils.defineLazyServiceGetter(this, "Telemetry",
"@mozilla.org/base/telemetry;1", "nsITelemetry");
XPCOMUtils.defineLazyServiceGetter(this, "sessionStartup",
"@mozilla.org/browser/sessionstartup;1", "nsISessionStartup");
ChromeUtils.defineModuleGetter(this, "SessionWorker",
"resource:///modules/sessionstore/SessionWorker.jsm");
ChromeUtils.defineModuleGetter(this, "SessionStore",
"resource:///modules/sessionstore/SessionStore.jsm");
XPCOMUtils.defineLazyModuleGetters(this, {
RunState: "resource:///modules/sessionstore/RunState.jsm",
SessionStartup: "resource:///modules/sessionstore/SessionStartup.jsm",
SessionStore: "resource:///modules/sessionstore/SessionStore.jsm",
SessionWorker: "resource:///modules/sessionstore/SessionWorker.jsm",
});
const PREF_UPGRADE_BACKUP = "browser.sessionstore.upgradeBackup.latestBuildID";
const PREF_MAX_UPGRADE_BACKUPS = "browser.sessionstore.upgradeBackup.maxUpgradeBackups";
@ -384,7 +383,7 @@ var SessionFileInternal = {
}
let performShutdownCleanup = isFinalWrite &&
!sessionStartup.isAutomaticRestoreEnabled();
!SessionStartup.isAutomaticRestoreEnabled();
this._attempts++;
let options = {isFinalWrite, performShutdownCleanup};

Просмотреть файл

@ -29,9 +29,10 @@
* browser.startup.page is set to 3.
*/
var EXPORTED_SYMBOLS = ["SessionStartup"];
/* :::::::: Constants and Helpers ::::::::::::::: */
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
ChromeUtils.import("resource://gre/modules/Services.jsm");
ChromeUtils.defineModuleGetter(this, "SessionFile",
@ -45,13 +46,14 @@ ChromeUtils.defineModuleGetter(this, "PrivateBrowsingUtils",
const STATE_RUNNING_STR = "running";
const TYPE_NO_SESSION = 0;
const TYPE_RECOVER_SESSION = 1;
const TYPE_RESUME_SESSION = 2;
const TYPE_DEFER_SESSION = 3;
// 'browser.startup.page' preference value to resume the previous session.
const BROWSER_STARTUP_RESUME_SESSION = 3;
function debug(aMsg) {
aMsg = ("SessionStartup: " + aMsg).replace(/\S{80}/g, "$&\n");
Services.console.logStringMessage(aMsg);
}
function warning(aMsg, aException) {
let consoleMsg = Cc["@mozilla.org/scripterror;1"].createInstance(Ci.nsIScriptError);
consoleMsg.init(aMsg, aException.fileName, null, aException.lineNumber, 0, Ci.nsIScriptError.warningFlag, "component javascript");
@ -71,14 +73,15 @@ var gOnceInitializedDeferred = (function() {
/* :::::::: The Service ::::::::::::::: */
function SessionStartup() {
}
SessionStartup.prototype = {
var SessionStartup = {
NO_SESSION: TYPE_NO_SESSION,
RECOVER_SESSION: TYPE_RECOVER_SESSION,
RESUME_SESSION: TYPE_RESUME_SESSION,
DEFER_SESSION: TYPE_DEFER_SESSION,
// the state to restore at startup
_initialState: null,
_sessionType: Ci.nsISessionStartup.NO_SESSION,
_sessionType: TYPE_NO_SESSION,
_initialized: false,
// Stores whether the previous session crashed.
@ -161,7 +164,7 @@ SessionStartup.prototype = {
if (this._initialState == null) {
// No valid session found.
this._sessionType = Ci.nsISessionStartup.NO_SESSION;
this._sessionType = this.NO_SESSION;
Services.obs.notifyObservers(null, "sessionstore-state-finalized");
gOnceInitializedDeferred.resolve();
return;
@ -222,21 +225,21 @@ SessionStartup.prototype = {
// set the startup type
if (this._previousSessionCrashed && resumeFromCrash)
this._sessionType = Ci.nsISessionStartup.RECOVER_SESSION;
this._sessionType = this.RECOVER_SESSION;
else if (!this._previousSessionCrashed && this._resumeSessionEnabled)
this._sessionType = Ci.nsISessionStartup.RESUME_SESSION;
this._sessionType = this.RESUME_SESSION;
else if (this._initialState)
this._sessionType = Ci.nsISessionStartup.DEFER_SESSION;
this._sessionType = this.DEFER_SESSION;
else
this._initialState = null; // reset the state
Services.obs.addObserver(this, "sessionstore-windows-restored", true);
if (this._sessionType != Ci.nsISessionStartup.NO_SESSION)
if (this._sessionType != this.NO_SESSION)
Services.obs.addObserver(this, "browser:purge-session-history", true);
// We're ready. Notify everyone else.
Services.obs.notifyObservers(null, "sessionstore-state-finalized");
gOnceInitializedDeferred.resolve();
});
},
@ -246,22 +249,6 @@ SessionStartup.prototype = {
*/
observe: function sss_observe(aSubject, aTopic, aData) {
switch (aTopic) {
case "app-startup":
Services.obs.addObserver(this, "final-ui-startup", true);
Services.obs.addObserver(this, "quit-application", true);
break;
case "final-ui-startup":
Services.obs.removeObserver(this, "final-ui-startup");
Services.obs.removeObserver(this, "quit-application");
this.init();
break;
case "quit-application":
// no reason for initializing at this point (cf. bug 409115)
Services.obs.removeObserver(this, "final-ui-startup");
Services.obs.removeObserver(this, "quit-application");
if (this._sessionType != Ci.nsISessionStartup.NO_SESSION)
Services.obs.removeObserver(this, "browser:purge-session-history");
break;
case "sessionstore-windows-restored":
Services.obs.removeObserver(this, "sessionstore-windows-restored");
// free _initialState after nsSessionStore is done with it
@ -271,7 +258,7 @@ SessionStartup.prototype = {
case "browser:purge-session-history":
Services.obs.removeObserver(this, "browser:purge-session-history");
// reset all state on sanitization
this._sessionType = Ci.nsISessionStartup.NO_SESSION;
this._sessionType = this.NO_SESSION;
break;
}
},
@ -319,8 +306,8 @@ SessionStartup.prototype = {
* @returns bool
*/
_willRestore() {
return this._sessionType == Ci.nsISessionStartup.RECOVER_SESSION ||
this._sessionType == Ci.nsISessionStartup.RESUME_SESSION;
return this._sessionType == this.RECOVER_SESSION ||
this._sessionType == this.RESUME_SESSION;
},
/**
@ -371,11 +358,7 @@ SessionStartup.prototype = {
return this._previousSessionCrashed;
},
/* ........ QueryInterface .............. */
QueryInterface: ChromeUtils.generateQI([Ci.nsIObserver,
Ci.nsISupportsWeakReference,
Ci.nsISessionStartup]),
classID: Components.ID("{ec7a6c20-e081-11da-8ad9-0800200c9a66}")
Ci.nsISupportsWeakReference]),
};
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([SessionStartup]);

Просмотреть файл

@ -163,7 +163,6 @@ ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm", this);
ChromeUtils.import("resource://gre/modules/osfile.jsm", this);
XPCOMUtils.defineLazyServiceGetters(this, {
gSessionStartup: ["@mozilla.org/browser/sessionstartup;1", "nsISessionStartup"],
gScreenManager: ["@mozilla.org/gfx/screenmanager;1", "nsIScreenManager"],
Telemetry: ["@mozilla.org/base/telemetry;1", "nsITelemetry"],
});
@ -181,6 +180,7 @@ XPCOMUtils.defineLazyModuleGetters(this, {
SessionCookies: "resource:///modules/sessionstore/SessionCookies.jsm",
SessionFile: "resource:///modules/sessionstore/SessionFile.jsm",
SessionSaver: "resource:///modules/sessionstore/SessionSaver.jsm",
SessionStartup: "resource:///modules/sessionstore/SessionStartup.jsm",
TabAttributes: "resource:///modules/sessionstore/TabAttributes.jsm",
TabCrashHandler: "resource:///modules/ContentCrashHandlers.jsm",
TabState: "resource:///modules/sessionstore/TabState.jsm",
@ -639,10 +639,10 @@ var SessionStoreInternal = {
initSession() {
TelemetryStopwatch.start("FX_SESSION_RESTORE_STARTUP_INIT_SESSION_MS");
let state;
let ss = gSessionStartup;
let ss = SessionStartup;
if (ss.doRestore() ||
ss.sessionType == Ci.nsISessionStartup.DEFER_SESSION) {
ss.sessionType == ss.DEFER_SESSION) {
state = ss.state;
}
@ -650,7 +650,7 @@ var SessionStoreInternal = {
try {
// If we're doing a DEFERRED session, then we want to pull pinned tabs
// out so they can be restored.
if (ss.sessionType == Ci.nsISessionStartup.DEFER_SESSION) {
if (ss.sessionType == ss.DEFER_SESSION) {
let [iniState, remainingState] = this._prepDataForDeferredRestore(state);
// If we have a iniState with windows, that means that we have windows
// with app tabs to restore.
@ -1159,7 +1159,7 @@ var SessionStoreInternal = {
// We're starting with a single private window. Save the state we
// actually wanted to restore so that we can do it later in case
// the user opens another, non-private window.
this._deferredInitialState = gSessionStartup.state;
this._deferredInitialState = SessionStartup.state;
// Nothing to restore now, notify observers things are complete.
Services.obs.notifyObservers(null, NOTIFY_WINDOWS_RESTORED);
@ -1310,7 +1310,7 @@ var SessionStoreInternal = {
// We are ready for initialization as soon as the session file has been
// read from disk and the initial window's delayed startup has finished.
this._promiseReadyForInitialization =
Promise.all([promise, gSessionStartup.onceInitialized]);
Promise.all([promise, SessionStartup.onceInitialized]);
}
// We can't call this.onLoad since initialization
@ -4585,7 +4585,7 @@ var SessionStoreInternal = {
/**
* This is going to take a state as provided at startup (via
* nsISessionStartup.state) and split it into 2 parts. The first part
* SessionStartup.state) and split it into 2 parts. The first part
* (defaultState) will be a state that should still be restored at startup,
* while the second part (state) is a state that should be saved for later.
* defaultState will be comprised of windows with only pinned tabs, extracted
@ -4596,12 +4596,12 @@ var SessionStoreInternal = {
* to restore the previous session (publicly exposed as restoreLastSession).
*
* @param state
* The state, presumably from nsISessionStartup.state
* The state, presumably from SessionStartup.state
* @returns [defaultState, state]
*/
_prepDataForDeferredRestore: function ssi_prepDataForDeferredRestore(state) {
// Make sure that we don't modify the global state as provided by
// nsSessionStartup.state.
// SessionStartup.state.
state = Cu.cloneInto(state, {});
let defaultState = { windows: [], selectedWindow: 1 };

Просмотреть файл

@ -9,17 +9,6 @@ BROWSER_CHROME_MANIFESTS += ['test/browser.ini']
JAR_MANIFESTS += ['jar.mn']
XPIDL_SOURCES += [
'nsISessionStartup.idl',
]
XPIDL_MODULE = 'sessionstore'
EXTRA_COMPONENTS += [
'nsSessionStartup.js',
'nsSessionStartup.manifest',
]
EXTRA_JS_MODULES.sessionstore = [
'ContentRestore.jsm',
'ContentSessionStore.jsm',
@ -31,6 +20,7 @@ EXTRA_JS_MODULES.sessionstore = [
'SessionFile.jsm',
'SessionMigration.jsm',
'SessionSaver.jsm',
'SessionStartup.jsm',
'SessionStorage.jsm',
'SessionStore.jsm',
'SessionWorker.js',

Просмотреть файл

@ -1,64 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsISupports.idl"
/**
* nsISessionStore keeps track of the current browsing state - i.e.
* tab history, cookies, scroll state, form data, and window features
* - and allows to restore everything into one window.
*/
[scriptable, uuid(934697e4-3807-47f8-b6c9-6caa8d83ccd1)]
interface nsISessionStartup: nsISupports
{
/**
* Return a promise that is resolved once initialization
* is complete.
*/
readonly attribute jsval onceInitialized;
// Get session state
readonly attribute jsval state;
/**
* Determines whether there is a pending session restore. Should only be
* called after initialization has completed.
*/
boolean doRestore();
/**
* Determines whether automatic session restoration is enabled for this
* launch of the browser. This does not include crash restoration, and will
* return false if restoration will only be caused by a crash.
*/
boolean isAutomaticRestoreEnabled();
/**
* Returns a boolean or a promise that resolves to a boolean, indicating
* whether we will restore a session that ends up replacing the homepage.
* True guarantees that we'll restore a session; false means that we
* /probably/ won't do so.
* The browser uses this to avoid unnecessarily loading the homepage when
* restoring a session.
*/
readonly attribute jsval willOverrideHomepage;
/**
* What type of session we're restoring.
* NO_SESSION There is no data available from the previous session
* RECOVER_SESSION The last session crashed. It will either be restored or
* about:sessionrestore will be shown.
* RESUME_SESSION The previous session should be restored at startup
* DEFER_SESSION The previous session is fine, but it shouldn't be restored
* without explicit action (with the exception of pinned tabs)
*/
const unsigned long NO_SESSION = 0;
const unsigned long RECOVER_SESSION = 1;
const unsigned long RESUME_SESSION = 2;
const unsigned long DEFER_SESSION = 3;
readonly attribute unsigned long sessionType;
readonly attribute bool previousSessionCrashed;
};

Просмотреть файл

@ -1,10 +0,0 @@
# This component must restrict its registration for the app-startup category
# to the specific list of apps that use it so it doesn't get loaded in xpcshell.
# Thus we restrict it to these apps:
#
# browser: {ec8030f7-c20a-464f-9b0e-13a3a9e97384}
# mobile/android: {aa3c5121-dab2-40e2-81ca-7ea25febc110}
component {ec7a6c20-e081-11da-8ad9-0800200c9a66} nsSessionStartup.js
contract @mozilla.org/browser/sessionstartup;1 {ec7a6c20-e081-11da-8ad9-0800200c9a66}
category app-startup nsSessionStartup service,@mozilla.org/browser/sessionstartup;1 application={ec8030f7-c20a-464f-9b0e-13a3a9e97384} application={aa3c5121-dab2-40e2-81ca-7ea25febc110}

Просмотреть файл

@ -1,5 +1,7 @@
ChromeUtils.import("resource://gre/modules/Services.jsm");
const {OS} = ChromeUtils.import("resource://gre/modules/osfile.jsm", {});
ChromeUtils.defineModuleGetter(this, "SessionStartup",
"resource:///modules/sessionstore/SessionStartup.jsm");
// Call a function once initialization of SessionStartup is complete
function afterSessionStartupInitialization(cb) {
@ -13,6 +15,7 @@ function afterSessionStartupInitialization(cb) {
do_throw(ex);
}
};
Services.obs.addObserver(observer, "sessionstore-state-finalized");
// We need the Crash Monitor initialized for sessionstartup to run
// successfully.
@ -20,12 +23,7 @@ function afterSessionStartupInitialization(cb) {
CrashMonitor.init();
// Start sessionstartup initialization.
let startup = Cc["@mozilla.org/browser/sessionstartup;1"].
getService(Ci.nsIObserver);
Services.obs.addObserver(startup, "final-ui-startup");
Services.obs.addObserver(startup, "quit-application");
Services.obs.notifyObservers(null, "final-ui-startup");
Services.obs.addObserver(observer, "sessionstore-state-finalized");
SessionStartup.init();
}
// Compress the source file using lz4 and put the result to destination file.

Просмотреть файл

@ -15,11 +15,8 @@ function run_test() {
// and remove sessionstore.js
let oldExtSessionFile = SessionFile.Paths.clean.replace("jsonlz4", "js");
writeCompressedFile(oldExtSessionFile, SessionFile.Paths.clean).then(() => {
let startup = Cc["@mozilla.org/browser/sessionstartup;1"].
getService(Ci.nsISessionStartup);
afterSessionStartupInitialization(function cb() {
Assert.equal(startup.sessionType, Ci.nsISessionStartup.NO_SESSION);
Assert.equal(SessionStartup.sessionType, SessionStartup.NO_SESSION);
do_test_finished();
});
});

Просмотреть файл

@ -2,21 +2,19 @@
http://creativecommons.org/publicdomain/zero/1.0/ */
// Test nsISessionStartup.sessionType in the following scenario:
// Test SessionStartup.sessionType in the following scenario:
// - no sessionstore.js;
// - the session store has been loaded, so no need to go
// through the synchronous fallback
function run_test() {
do_get_profile();
// Initialize the profile (the session startup uses it)
do_get_profile();
do_test_pending();
let startup = Cc["@mozilla.org/browser/sessionstartup;1"].
getService(Ci.nsISessionStartup);
afterSessionStartupInitialization(function cb() {
Assert.equal(startup.sessionType, Ci.nsISessionStartup.NO_SESSION);
Assert.equal(SessionStartup.sessionType, SessionStartup.NO_SESSION);
do_test_finished();
});
}

Просмотреть файл

@ -2,7 +2,7 @@
http://creativecommons.org/publicdomain/zero/1.0/ */
// Test nsISessionStartup.sessionType in the following scenario:
// Test SessionStartup.sessionType in the following scenario:
// - valid sessionstore.js;
// - valid sessionCheckpoints.json with all checkpoints;
// - the session store has been loaded
@ -21,11 +21,8 @@ function run_test() {
// and remove sessionstore.js
let oldExtSessionFile = SessionFile.Paths.clean.replace("jsonlz4", "js");
writeCompressedFile(oldExtSessionFile, SessionFile.Paths.clean).then(() => {
let startup = Cc["@mozilla.org/browser/sessionstartup;1"].
getService(Ci.nsISessionStartup);
afterSessionStartupInitialization(function cb() {
Assert.equal(startup.sessionType, Ci.nsISessionStartup.DEFER_SESSION);
Assert.equal(SessionStartup.sessionType, SessionStartup.DEFER_SESSION);
do_test_finished();
});
});

Просмотреть файл

@ -242,8 +242,6 @@
@RESPATH@/components/ProcessSingleton.manifest
@RESPATH@/components/MainProcessSingleton.js
@RESPATH@/components/ContentProcessSingleton.js
@RESPATH@/browser/components/nsSessionStartup.manifest
@RESPATH@/browser/components/nsSessionStartup.js
@RESPATH@/components/nsURLFormatter.manifest
@RESPATH@/components/nsURLFormatter.js
@RESPATH@/components/txEXSLTRegExFunctions.manifest

Просмотреть файл

@ -289,7 +289,7 @@ class TestUrlFinder(unittest.TestCase):
'path1',
None
],
'dist/bin/browser/components/nsSessionStartup.js': [
'dist/bin/browser/components/nsBrowserGlue.js': [
'path2',
None
],
@ -334,7 +334,7 @@ class TestUrlFinder(unittest.TestCase):
paths = [
('jar:file:///home/worker/workspace/build/application/' + app_name + '/' + omnijar_name + '!/components/MainProcessSingleton.js', 'path1'),
('jar:file:///home/worker/workspace/build/application/' + app_name + '/browser/' + omnijar_name + '!/components/nsSessionStartup.js', 'path2'),
('jar:file:///home/worker/workspace/build/application/' + app_name + '/browser/' + omnijar_name + '!/components/nsBrowserGlue.js', 'path2'),
('jar:file:///home/worker/workspace/build/application/' + app_name + '/browser/features/firefox@getpocket.com.xpi!/bootstrap.js', 'path4'),
]

Просмотреть файл

@ -6,12 +6,12 @@
"use strict";
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
ChromeUtils.defineModuleGetter(this, "Services",
"resource://gre/modules/Services.jsm");
ChromeUtils.defineModuleGetter(this, "setTimeout",
"resource://gre/modules/Timer.jsm");
ChromeUtils.defineModuleGetter(this, "SessionStartup",
"resource:///modules/sessionstore/SessionStartup.jsm");
ChromeUtils.defineModuleGetter(this, "StartupPerformance",
"resource:///modules/sessionstore/StartupPerformance.jsm");
@ -49,11 +49,9 @@ const sessionRestoreTest = {
if (StartupPerformance.isRestored) {
this.onReady(true);
} else {
let sessionStartup = Cc["@mozilla.org/browser/sessionstartup;1"]
.getService(Ci.nsISessionStartup);
sessionStartup.onceInitialized.then(() => {
if (sessionStartup.sessionType == Ci.nsISessionStartup.NO_SESSION
|| sessionStartup.sessionType == Ci.nsISessionStartup.DEFER_SESSION) {
SessionStartup.onceInitialized.then(() => {
if (SessionStartup.sessionType == SessionStartup.NO_SESSION ||
SessionStartup.sessionType == SessionStartup.DEFER_SESSION) {
this.onReady(false);
} else {
Services.obs.addObserver(this, StartupPerformance.RESTORED_TOPIC);