Fx60 compatibility: Fix issues with JS code modules
- The Mozilla CommonJS loader is no longer available, so bundle the Fx52 version of it - Strict mode is enforced - `this` is only defined as a global object in .jsm files, not .js files - `this` can't be converted to a string for BackstagePass test, so check for presence of Components.utils.import instead - The return value from import() is no longer available
This commit is contained in:
parent
1d4a97c220
commit
c2b77890c3
|
@ -7,4 +7,4 @@ var Zotero = Components.classes['@zotero.org/Zotero;1']
|
||||||
.getService(Components.interfaces.nsISupports)
|
.getService(Components.interfaces.nsISupports)
|
||||||
.wrappedJSObject;
|
.wrappedJSObject;
|
||||||
|
|
||||||
Components.utils.import('resource://zotero/require.js');
|
Components.utils.import('resource://zotero/require.jsm');
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
Components.utils.import("resource://zotero/pathparser.js", Zotero);
|
Components.utils.import("resource://zotero/pathparser.jsm", Zotero);
|
||||||
Zotero.Router = Zotero.PathParser;
|
Zotero.Router = Zotero.PathParser;
|
||||||
delete Zotero.PathParser;
|
delete Zotero.PathParser;
|
||||||
|
|
||||||
|
|
|
@ -154,9 +154,9 @@ var isFirstLoadThisSession = true;
|
||||||
var zContext = null;
|
var zContext = null;
|
||||||
var initCallbacks = [];
|
var initCallbacks = [];
|
||||||
var zInitOptions = {};
|
var zInitOptions = {};
|
||||||
Components.utils.import('resource://zotero/require.js');
|
Components.utils.import('resource://zotero/require.jsm');
|
||||||
|
|
||||||
ZoteroContext = function() {}
|
var ZoteroContext = function() {}
|
||||||
ZoteroContext.prototype = {
|
ZoteroContext.prototype = {
|
||||||
require,
|
require,
|
||||||
|
|
||||||
|
|
|
@ -23,8 +23,8 @@
|
||||||
***** END LICENSE BLOCK *****
|
***** END LICENSE BLOCK *****
|
||||||
*/
|
*/
|
||||||
|
|
||||||
EXPORTED_SYMBOLS = ["ConcurrentCaller"];
|
var EXPORTED_SYMBOLS = ["ConcurrentCaller"];
|
||||||
Components.utils.import('resource://zotero/require.js');
|
Components.utils.import('resource://zotero/require.jsm');
|
||||||
|
|
||||||
var Promise = require('resource://zotero/bluebird.js');
|
var Promise = require('resource://zotero/bluebird.js');
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ var Promise = require('resource://zotero/bluebird.js');
|
||||||
* beginning of another, in milliseconds
|
* beginning of another, in milliseconds
|
||||||
* @param {Function} [options.logger]
|
* @param {Function} [options.logger]
|
||||||
*/
|
*/
|
||||||
ConcurrentCaller = function (options = {}) {
|
var ConcurrentCaller = function (options = {}) {
|
||||||
if (typeof options == 'number') {
|
if (typeof options == 'number') {
|
||||||
this._log("ConcurrentCaller now takes an object rather than a number");
|
this._log("ConcurrentCaller now takes an object rather than a number");
|
||||||
options = {
|
options = {
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
var EXPORTED_SYMBOLS = ["ZOTERO_CONFIG"];
|
||||||
|
|
||||||
var ZOTERO_CONFIG = {
|
var ZOTERO_CONFIG = {
|
||||||
GUID: 'zotero@chnm.gmu.edu',
|
GUID: 'zotero@chnm.gmu.edu',
|
||||||
ID: 'zotero', // used for db filename, etc.
|
ID: 'zotero', // used for db filename, etc.
|
||||||
|
@ -25,5 +27,3 @@ var ZOTERO_CONFIG = {
|
||||||
FEEDBACK_URL: "https://forums.zotero.org/",
|
FEEDBACK_URL: "https://forums.zotero.org/",
|
||||||
CONNECTORS_URL: "https://www.zotero.org/download/connectors"
|
CONNECTORS_URL: "https://www.zotero.org/download/connectors"
|
||||||
};
|
};
|
||||||
|
|
||||||
EXPORTED_SYMBOLS = ["ZOTERO_CONFIG"];
|
|
||||||
|
|
1148
resource/loader.jsm
Normal file
1148
resource/loader.jsm
Normal file
File diff suppressed because it is too large
Load Diff
|
@ -5,7 +5,7 @@
|
||||||
* License: MIT
|
* License: MIT
|
||||||
* https://github.com/dstillman/pathparser.js
|
* https://github.com/dstillman/pathparser.js
|
||||||
*/
|
*/
|
||||||
(function (factory) {
|
(function (root, factory) {
|
||||||
// AMD/RequireJS
|
// AMD/RequireJS
|
||||||
if (typeof define === 'function' && define.amd) {
|
if (typeof define === 'function' && define.amd) {
|
||||||
define(factory);
|
define(factory);
|
||||||
|
@ -13,14 +13,16 @@
|
||||||
} else if (typeof exports === 'object') {
|
} else if (typeof exports === 'object') {
|
||||||
module.exports = factory();
|
module.exports = factory();
|
||||||
// Mozilla JSM
|
// Mozilla JSM
|
||||||
} else if (~String(this).indexOf('BackstagePass')) {
|
} else if (typeof Components != 'undefined'
|
||||||
EXPORTED_SYMBOLS = ["PathParser"];
|
&& typeof Components.utils != 'undefined'
|
||||||
PathParser = factory();
|
&& typeof Components.utils.import == 'function') {
|
||||||
|
root.EXPORTED_SYMBOLS = ["PathParser"];
|
||||||
|
root.PathParser = factory();
|
||||||
// Browser global
|
// Browser global
|
||||||
} else {
|
} else {
|
||||||
PathParser = factory();
|
root.PathParser = factory();
|
||||||
}
|
}
|
||||||
}(function () {
|
}(this, function () {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
var PathParser = function (params) {
|
var PathParser = function (params) {
|
|
@ -3,7 +3,7 @@
|
||||||
var EXPORTED_SYMBOLS = ['require'];
|
var EXPORTED_SYMBOLS = ['require'];
|
||||||
|
|
||||||
var require = (function() {
|
var require = (function() {
|
||||||
var { Loader, Require, Module } = Components.utils.import('resource://gre/modules/commonjs/toolkit/loader.js');
|
Components.utils.import('resource://zotero/loader.jsm');
|
||||||
var requirer = Module('/', '/');
|
var requirer = Module('/', '/');
|
||||||
var _runningTimers = {};
|
var _runningTimers = {};
|
||||||
var window = {};
|
var window = {};
|
|
@ -27,7 +27,7 @@
|
||||||
* installable and available in the cite preferences pane.
|
* installable and available in the cite preferences pane.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
EXPORTED_SYMBOLS = ["ZoteroPluginInstaller"];
|
var EXPORTED_SYMBOLS = ["ZoteroPluginInstaller"];
|
||||||
|
|
||||||
var Zotero = Components.classes["@zotero.org/Zotero;1"]
|
var Zotero = Components.classes["@zotero.org/Zotero;1"]
|
||||||
// Currently uses only nsISupports
|
// Currently uses only nsISupports
|
||||||
|
|
Loading…
Reference in New Issue
Block a user