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