Fx60: 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
f7854bfcae
commit
78e9db9523
8 changed files with 1164 additions and 14 deletions
|
@ -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;
|
||||||
|
|
||||||
|
|
|
@ -161,7 +161,7 @@ Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
|
||||||
.getService(Components.interfaces.mozIJSSubScriptLoader)
|
.getService(Components.interfaces.mozIJSSubScriptLoader)
|
||||||
.loadSubScript('resource://zotero/require.js');
|
.loadSubScript('resource://zotero/require.js');
|
||||||
|
|
||||||
ZoteroContext = function() {}
|
var ZoteroContext = function() {}
|
||||||
ZoteroContext.prototype = {
|
ZoteroContext.prototype = {
|
||||||
require,
|
require,
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
***** END LICENSE BLOCK *****
|
***** END LICENSE BLOCK *****
|
||||||
*/
|
*/
|
||||||
|
|
||||||
EXPORTED_SYMBOLS = ["ConcurrentCaller"];
|
var EXPORTED_SYMBOLS = ["ConcurrentCaller"];
|
||||||
|
|
||||||
if (!(typeof process === 'object' && process + '' === '[object process]')) {
|
if (!(typeof process === 'object' && process + '' === '[object process]')) {
|
||||||
// Components.utils.import('resource://zotero/require.js');
|
// Components.utils.import('resource://zotero/require.js');
|
||||||
|
@ -69,7 +69,7 @@ if (!(typeof process === 'object' && process + '' === '[object process]')) {
|
||||||
* @param {Object} [options.Promise] The Zotero instance of Promise to allow
|
* @param {Object} [options.Promise] The Zotero instance of Promise to allow
|
||||||
* stubbing/spying in tests
|
* stubbing/spying in tests
|
||||||
*/
|
*/
|
||||||
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 = {
|
||||||
|
|
|
@ -29,5 +29,5 @@ var ZOTERO_CONFIG = {
|
||||||
if (typeof process === 'object' && process + '' === '[object process]'){
|
if (typeof process === 'object' && process + '' === '[object process]'){
|
||||||
module.exports = ZOTERO_CONFIG;
|
module.exports = ZOTERO_CONFIG;
|
||||||
} else {
|
} else {
|
||||||
EXPORTED_SYMBOLS = ["ZOTERO_CONFIG"];
|
var 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) {
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
var require = (function() {
|
var require = (function() {
|
||||||
var win, Zotero;
|
var win, Zotero;
|
||||||
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 = {};
|
||||||
if (typeof window != 'undefined') {
|
if (typeof window != 'undefined') {
|
||||||
|
|
|
@ -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…
Add table
Add a link
Reference in a new issue