Remove all uses of Zotero.isStandalone
(View diff with -w)
This commit is contained in:
parent
4b7a1e8607
commit
8d3f874e64
7 changed files with 245 additions and 316 deletions
|
@ -982,7 +982,7 @@ Zotero.DataDirectory = {
|
|||
false,
|
||||
null,
|
||||
// Don't show message in a popup in Standalone if pane isn't ready
|
||||
Zotero.isStandalone
|
||||
true
|
||||
);
|
||||
}
|
||||
catch (e) {
|
||||
|
@ -1005,7 +1005,7 @@ Zotero.DataDirectory = {
|
|||
|
||||
// Clear status line from progress meter
|
||||
try {
|
||||
Zotero.showZoteroPaneProgressMeter("", false, null, Zotero.isStandalone);
|
||||
Zotero.showZoteroPaneProgressMeter("", false, null, true);
|
||||
}
|
||||
catch (e) {
|
||||
Zotero.logError(e);
|
||||
|
|
|
@ -70,7 +70,6 @@ Zotero.Debug = new function () {
|
|||
this.storing = _store;
|
||||
this.updateEnabled();
|
||||
|
||||
if (Zotero.isStandalone) {
|
||||
// Enable dump() from window (non-XPCOM) scopes when terminal or viewer logging is enabled.
|
||||
// (These will always go to the terminal, even in viewer mode.)
|
||||
Zotero.Prefs.set('browser.dom.window.dump.enabled', _console || _consoleViewer || Zotero.test, true);
|
||||
|
@ -81,7 +80,6 @@ Zotero.Debug = new function () {
|
|||
}, 1000);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.log = function (message, level, maxDepth, stack) {
|
||||
if (!this.enabled) {
|
||||
|
|
|
@ -949,8 +949,7 @@ Zotero.HTTP = new function() {
|
|||
* to wait for proxy authentication can wait for that promise.
|
||||
*/
|
||||
this.triggerProxyAuth = function () {
|
||||
if (!Zotero.isStandalone
|
||||
|| !Zotero.Prefs.get("triggerProxyAuthentication")
|
||||
if (!Zotero.Prefs.get("triggerProxyAuthentication")
|
||||
|| Zotero.HTTP.browserIsOffline()) {
|
||||
Zotero.proxyAuthComplete = Zotero.Promise.resolve();
|
||||
return false;
|
||||
|
|
|
@ -92,8 +92,7 @@ Zotero.Profile = {
|
|||
|
||||
|
||||
/**
|
||||
* Get the path to the Profiles directory of the other app from this one (Firefox or Zotero),
|
||||
* which may or may not exist
|
||||
* Get the path to the Firefox Profiles directory, which may or may not exist
|
||||
*
|
||||
* @return {String|null} - Path, or null if none due to filesystem location
|
||||
*/
|
||||
|
@ -103,7 +102,6 @@ Zotero.Profile = {
|
|||
return null;
|
||||
}
|
||||
|
||||
if (Zotero.isStandalone) {
|
||||
if (Zotero.isWin) {
|
||||
dir = OS.Path.join(OS.Path.dirname(dir), "Mozilla", "Firefox");
|
||||
}
|
||||
|
@ -113,17 +111,6 @@ Zotero.Profile = {
|
|||
else {
|
||||
dir = OS.Path.join(dir, ".mozilla", "firefox");
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (Zotero.isWin) {
|
||||
dir = OS.Path.join(OS.Path.dirname(dir), "Zotero", "Zotero");
|
||||
}
|
||||
else if (Zotero.isMac) {
|
||||
dir = OS.Path.join(dir, "Zotero");
|
||||
} else {
|
||||
dir = OS.Path.join(dir, ".zotero", "zotero");
|
||||
}
|
||||
}
|
||||
|
||||
return OS.Path.join(dir, "Profiles");
|
||||
},
|
||||
|
|
|
@ -348,7 +348,7 @@ Zotero.Schema = new function(){
|
|||
}, 250);
|
||||
}
|
||||
}
|
||||
}.bind(this), Zotero.isStandalone ? 1000 : 0);
|
||||
}.bind(this), 1000);
|
||||
});
|
||||
|
||||
return updated;
|
||||
|
@ -928,37 +928,10 @@ Zotero.Schema = new function(){
|
|||
|
||||
// Get path to add-on
|
||||
|
||||
// Synchronous in Standalone
|
||||
if (Zotero.isStandalone) {
|
||||
var installLocation = Components.classes["@mozilla.org/file/directory_service;1"]
|
||||
.getService(Components.interfaces.nsIProperties)
|
||||
.get("AChrom", Components.interfaces.nsIFile).parent;
|
||||
installLocation.append("omni.ja");
|
||||
}
|
||||
// Asynchronous in Firefox
|
||||
else {
|
||||
let resolve, reject;
|
||||
let promise = new Zotero.Promise(function () {
|
||||
resolve = arguments[0];
|
||||
reject = arguments[1];
|
||||
});
|
||||
Components.utils.import("resource://gre/modules/AddonManager.jsm");
|
||||
AddonManager.getAddonByID(
|
||||
ZOTERO_CONFIG.GUID,
|
||||
function (addon) {
|
||||
try {
|
||||
installLocation = addon.getResourceURI()
|
||||
.QueryInterface(Components.interfaces.nsIFileURL).file;
|
||||
}
|
||||
catch (e) {
|
||||
reject(e);
|
||||
return;
|
||||
}
|
||||
resolve();
|
||||
}
|
||||
);
|
||||
await promise;
|
||||
}
|
||||
installLocation = installLocation.path;
|
||||
|
||||
let initOpts = { fromSchemaUpdate: true };
|
||||
|
|
|
@ -209,23 +209,9 @@ Services.scriptloader.loadSubScript("resource://zotero/polyfill.js");
|
|||
this.platformMajorVersion = parseInt(this.platformVersion.match(/^[0-9]+/)[0]);
|
||||
this.isFx = true;
|
||||
this.isClient = true;
|
||||
this.isStandalone = Services.appinfo.ID == ZOTERO_CONFIG['GUID'];
|
||||
this.isStandalone = true;
|
||||
|
||||
if (Zotero.isStandalone) {
|
||||
var version = Services.appinfo.version;
|
||||
}
|
||||
else {
|
||||
let deferred = Zotero.Promise.defer();
|
||||
Components.utils.import("resource://gre/modules/AddonManager.jsm");
|
||||
AddonManager.getAddonByID(
|
||||
ZOTERO_CONFIG.GUID,
|
||||
function (addon) {
|
||||
deferred.resolve(addon.version);
|
||||
}
|
||||
);
|
||||
var version = await deferred.promise;
|
||||
}
|
||||
Zotero.version = version;
|
||||
Zotero.version = Services.appinfo.version;
|
||||
Zotero.isDevBuild = Zotero.version.includes('beta')
|
||||
|| Zotero.version.includes('dev')
|
||||
|| Zotero.version.includes('SOURCE');
|
||||
|
@ -244,14 +230,21 @@ Services.scriptloader.loadSubScript("resource://zotero/polyfill.js");
|
|||
// Browser
|
||||
Zotero.browser = "g";
|
||||
|
||||
if (this.isWin) {
|
||||
let branch = Services.prefs.getBranch("toolkit.startup.");
|
||||
if (branch.getUserPref('recent_crashes') > 2) {
|
||||
branch.clearUserPref('recent_crashes');
|
||||
}
|
||||
}
|
||||
|
||||
Zotero.Intl.init();
|
||||
if (this.restarting) return;
|
||||
|
||||
await Zotero.Prefs.init();
|
||||
Zotero.Debug.init(options && options.forceDebugLog);
|
||||
|
||||
// Make sure that Zotero Standalone is not running as root
|
||||
if(Zotero.isStandalone && !Zotero.isWin) _checkRoot();
|
||||
// Make sure that Zotero isn't running as root
|
||||
if (!Zotero.isWin) _checkRoot();
|
||||
|
||||
if (!_checkExecutableLocation()) {
|
||||
return;
|
||||
|
@ -405,7 +398,7 @@ Services.scriptloader.loadSubScript("resource://zotero/polyfill.js");
|
|||
return false;
|
||||
}
|
||||
|
||||
if (Zotero.isStandalone) Zotero.Standalone.init();
|
||||
Zotero.Standalone.init();
|
||||
await Zotero.initComplete();
|
||||
};
|
||||
|
||||
|
@ -545,7 +538,6 @@ Services.scriptloader.loadSubScript("resource://zotero/polyfill.js");
|
|||
|
||||
try {
|
||||
// Require >=2.1b3 database to ensure proper locking
|
||||
if (Zotero.isStandalone) {
|
||||
let dbSystemVersion = yield Zotero.Schema.getDBVersion('system');
|
||||
if (dbSystemVersion > 0 && dbSystemVersion < 31) {
|
||||
var ps = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
|
||||
|
@ -594,7 +586,6 @@ Services.scriptloader.loadSubScript("resource://zotero/polyfill.js");
|
|||
|
||||
throw true;
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
var updated = yield Zotero.Schema.updateSchema({
|
||||
|
|
|
@ -328,10 +328,7 @@ function makeZoteroContext(isConnector) {
|
|||
subscriptLoader.loadSubScript("chrome://zotero/content/xpcom/translate/src/" + rdfXpcomFiles[i] + ".js", zContext.Zotero.RDF, 'utf-8');
|
||||
}
|
||||
|
||||
if(isStandalone()) {
|
||||
// If isStandalone, load standalone.js
|
||||
subscriptLoader.loadSubScript("chrome://zotero/content/xpcom/standalone.js", zContext, 'utf-8');
|
||||
}
|
||||
subscriptLoader.loadSubScript("chrome://zotero/content/xpcom/standalone.js", zContext);
|
||||
|
||||
// add connector-related properties
|
||||
zContext.Zotero.isConnector = isConnector;
|
||||
|
@ -355,12 +352,8 @@ function ZoteroService() {
|
|||
if (!zContext.Zotero.startupError) {
|
||||
zContext.Zotero.startupError = e.stack || e;
|
||||
}
|
||||
if (!isStandalone()) {
|
||||
throw e;
|
||||
}
|
||||
})
|
||||
.then(function () {
|
||||
if (isStandalone()) {
|
||||
if (zContext.Zotero.startupErrorHandler || zContext.Zotero.startupError) {
|
||||
if (zContext.Zotero.startupErrorHandler) {
|
||||
zContext.Zotero.startupErrorHandler();
|
||||
|
@ -419,10 +412,6 @@ function ZoteroService() {
|
|||
}
|
||||
zContext.Zotero.Utilities.Internal.quitZotero();
|
||||
}
|
||||
return;
|
||||
}
|
||||
zContext.Zotero.debug("Initialized in "+(Date.now() - start)+" ms");
|
||||
isFirstLoadThisSession = false;
|
||||
});
|
||||
|
||||
let cb;
|
||||
|
@ -457,7 +446,6 @@ function addInitCallback(callback) {
|
|||
}
|
||||
}
|
||||
|
||||
var _isStandalone = null;
|
||||
/**
|
||||
* Determine whether Zotero Standalone is running
|
||||
*/
|
||||
|
@ -505,11 +493,6 @@ ZoteroCommandLineHandler.prototype = {
|
|||
|
||||
zInitOptions.forceDataDir = cmdLine.handleFlagWithParam("datadir", false);
|
||||
|
||||
// handler to open Zotero pane at startup in Zotero for Firefox
|
||||
if (!isStandalone() && cmdLine.handleFlag("ZoteroPaneOpen", false)) {
|
||||
zInitOptions.openPane = true;
|
||||
}
|
||||
|
||||
if (cmdLine.handleFlag("ZoteroTest", false)) {
|
||||
zInitOptions.test = true;
|
||||
}
|
||||
|
@ -535,7 +518,6 @@ ZoteroCommandLineHandler.prototype = {
|
|||
zContext.Zotero.Integration.execCommand(agent, command, docId, templateVersion);
|
||||
}
|
||||
|
||||
if(isStandalone()) {
|
||||
var fileToOpen;
|
||||
// Handle zotero:// and file URIs and prevent them from opening a new window
|
||||
var param = cmdLine.handleFlagWithParam("url", false);
|
||||
|
@ -655,7 +637,6 @@ ZoteroCommandLineHandler.prototype = {
|
|||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
classID: Components.ID("{531828f8-a16c-46be-b9aa-14845c3b010f}"),
|
||||
|
|
Loading…
Reference in a new issue