Remove obsolete code for old Firefox versions
This commit is contained in:
parent
3bf82a4d4d
commit
6f6ce33377
10 changed files with 82 additions and 159 deletions
|
@ -1071,9 +1071,6 @@
|
|||
<body>
|
||||
<![CDATA[
|
||||
var sbo = document.getAnonymousNodes(this)[0].boxObject;
|
||||
if (Zotero.platformMajorVersion < 36) {
|
||||
sbo.QueryInterface(Components.interfaces.nsIScrollBoxObject);
|
||||
}
|
||||
sbo.ensureElementIsVisible(elem);
|
||||
]]>
|
||||
</body>
|
||||
|
|
|
@ -1019,9 +1019,6 @@
|
|||
<body>
|
||||
<![CDATA[
|
||||
var sbo = document.getAnonymousNodes(this)[0].boxObject;
|
||||
if (Zotero.platformMajorVersion < 36) {
|
||||
sbo.QueryInterface(Components.interfaces.nsIScrollBoxObject);
|
||||
}
|
||||
sbo.ensureElementIsVisible(elem);
|
||||
]]>
|
||||
</body>
|
||||
|
|
|
@ -268,18 +268,9 @@ var Zotero_Browser = new function() {
|
|||
function(e) { Zotero_Browser.resize(e) }, false);
|
||||
// Resize on text zoom changes
|
||||
|
||||
// Fx2
|
||||
var reduce = document.getElementById('cmd_textZoomReduce');
|
||||
if (reduce) {
|
||||
var enlarge = document.getElementById('cmd_textZoomEnlarge');
|
||||
var reset = document.getElementById('cmd_textZoomReset');
|
||||
}
|
||||
// Fx3
|
||||
else {
|
||||
var reduce = document.getElementById('cmd_fullZoomReduce');
|
||||
var enlarge = document.getElementById('cmd_fullZoomEnlarge');
|
||||
var reset = document.getElementById('cmd_fullZoomReset');
|
||||
}
|
||||
var reduce = document.getElementById('cmd_fullZoomReduce');
|
||||
var enlarge = document.getElementById('cmd_fullZoomEnlarge');
|
||||
var reset = document.getElementById('cmd_fullZoomReset');
|
||||
|
||||
if(reduce) reduce.addEventListener("command",
|
||||
function(e) { Zotero_Browser.resize(e) }, false);
|
||||
|
|
|
@ -44,62 +44,29 @@ var Zotero_Charset_Menu = new function() {
|
|||
|
||||
var charsets = [];
|
||||
|
||||
if(Zotero.platformMajorVersion >= 32) {
|
||||
Components.utils.import("resource://gre/modules/CharsetMenu.jsm");
|
||||
var cmData = CharsetMenu.getData();
|
||||
for (let charsetList of [cmData.pinnedCharsets, cmData.otherCharsets]) {
|
||||
for each(var charsetInfo in charsetList) {
|
||||
if(charsetInfo.value == "UTF-8") {
|
||||
charsets.push({
|
||||
"label":"Unicode (UTF-8)",
|
||||
"value":"UTF-8"
|
||||
});
|
||||
} else {
|
||||
charsets.push({
|
||||
"label":charsetInfo.label,
|
||||
"value":charsetInfo.value
|
||||
});
|
||||
}
|
||||
Components.utils.import("resource://gre/modules/CharsetMenu.jsm");
|
||||
var cmData = CharsetMenu.getData();
|
||||
for (let charsetList of [cmData.pinnedCharsets, cmData.otherCharsets]) {
|
||||
for each(var charsetInfo in charsetList) {
|
||||
if(charsetInfo.value == "UTF-8") {
|
||||
charsets.push({
|
||||
"label":"Unicode (UTF-8)",
|
||||
"value":"UTF-8"
|
||||
});
|
||||
} else {
|
||||
charsets.push({
|
||||
"label":charsetInfo.label,
|
||||
"value":charsetInfo.value
|
||||
});
|
||||
}
|
||||
}
|
||||
charsets = charsets.concat([
|
||||
{"label":"UTF-16LE", "value":"UTF-16LE"},
|
||||
{"label":"UTF-16BE", "value":"UTF-16BE"},
|
||||
{"label":"Western (IBM-850)", "value":"IBM850"},
|
||||
{"label":"Western (MacRoman)", "value":"macintosh"}
|
||||
]);
|
||||
} else {
|
||||
var charsetConverter = Components.classes["@mozilla.org/charset-converter-manager;1"].
|
||||
getService(Components.interfaces.nsICharsetConverterManager);
|
||||
var ccCharsets = charsetConverter.getEncoderList();
|
||||
// add charsets to popup in order
|
||||
while(ccCharsets.hasMore()) {
|
||||
var charset = ccCharsets.getNext();
|
||||
try {
|
||||
var label = charsetConverter.getCharsetTitle(charset);
|
||||
} catch(e) {
|
||||
continue;
|
||||
}
|
||||
|
||||
var isUTF16 = charset.length >= 6 && charset.substr(0, 6) == "UTF-16";
|
||||
|
||||
// Show UTF-16 element appropriately depending on exportMenu
|
||||
if(isUTF16 && exportMenu == (charset == "UTF-16") ||
|
||||
(!exportMenu && charset == "UTF-32LE")) {
|
||||
continue;
|
||||
} else if(charset == "x-mac-roman") {
|
||||
// use the IANA name
|
||||
charset = "macintosh";
|
||||
} else if(!exportMenu && charset == "UTF-32BE") {
|
||||
label = "Unicode (UTF-32)";
|
||||
charset = "UTF-32";
|
||||
}
|
||||
charsets.push({
|
||||
"label":label,
|
||||
"value":charset
|
||||
});
|
||||
}
|
||||
}
|
||||
charsets = charsets.concat([
|
||||
{"label":"UTF-16LE", "value":"UTF-16LE"},
|
||||
{"label":"UTF-16BE", "value":"UTF-16BE"},
|
||||
{"label":"Western (IBM-850)", "value":"IBM850"},
|
||||
{"label":"Western (MacRoman)", "value":"macintosh"}
|
||||
]);
|
||||
|
||||
for(var i=0; i<charsets.length; i++) {
|
||||
var charset = charsets[i].value,
|
||||
|
|
|
@ -245,7 +245,7 @@ Zotero.OpenURL = new function() {
|
|||
}
|
||||
|
||||
function _cloneIfNecessary(obj1, obj2) {
|
||||
if(Zotero.isFx && !Zotero.isBookmarklet && Zotero.platformMajorVersion >= 32) {
|
||||
if (Zotero.isFx && !Zotero.isBookmarklet) {
|
||||
return Components.utils.cloneInto(obj1, obj2);
|
||||
}
|
||||
return obj1;
|
||||
|
|
|
@ -429,7 +429,7 @@ Zotero.Translate.Sandbox = {
|
|||
});
|
||||
};
|
||||
|
||||
if(Zotero.isFx && Zotero.platformMajorVersion >= 33) {
|
||||
if (Zotero.isFx) {
|
||||
for(var i in safeTranslator) {
|
||||
if (typeof(safeTranslator[i]) === "function") {
|
||||
safeTranslator[i] = translate._sandboxManager._makeContentForwarder(function(func) {
|
||||
|
|
|
@ -407,56 +407,52 @@ Zotero.Translate.SandboxManager = function(sandboxLocation) {
|
|||
var expr = "(function(x) { return function() { this.args = arguments; return Function.prototype.apply.call(x, this); }.bind({}); })";
|
||||
this._makeContentForwarder = Components.utils.evalInSandbox(expr, sandbox);
|
||||
|
||||
if (Zotero.platformMajorVersion >= 35) {
|
||||
var _proxy = Components.utils.evalInSandbox('(function (target, x, overrides) {'+
|
||||
' return new Proxy(x, ProxyHandler(target, overrides));'+
|
||||
'})', sandbox);
|
||||
var wrap = this.wrap = function(target, x, overrides) {
|
||||
if (target === null || (typeof target !== "object" && typeof target !== "function")) return target;
|
||||
if (!x) x = new sandbox.Object();
|
||||
return _proxy(target, x, overrides);
|
||||
var _proxy = Components.utils.evalInSandbox('(function (target, x, overrides) {'+
|
||||
' return new Proxy(x, ProxyHandler(target, overrides));'+
|
||||
'})', sandbox);
|
||||
var wrap = this.wrap = function(target, x, overrides) {
|
||||
if (target === null || (typeof target !== "object" && typeof target !== "function")) return target;
|
||||
if (!x) x = new sandbox.Object();
|
||||
return _proxy(target, x, overrides);
|
||||
};
|
||||
var me = this;
|
||||
sandbox.ProxyHandler = this._makeContentForwarder(function() {
|
||||
var target = (this.args.wrappedJSObject || this.args)[0];
|
||||
var overrides = (this.args.wrappedJSObject || this.args)[1] || {};
|
||||
if(target instanceof Components.interfaces.nsISupports) {
|
||||
target = new XPCNativeWrapper(target);
|
||||
}
|
||||
var ret = new sandbox.Object();
|
||||
var wrappedRet = ret.wrappedJSObject || ret;
|
||||
wrappedRet.has = function(x, prop) {
|
||||
return overrides.hasOwnProperty(prop) || prop in target;
|
||||
};
|
||||
var me = this;
|
||||
sandbox.ProxyHandler = this._makeContentForwarder(function() {
|
||||
var target = (this.args.wrappedJSObject || this.args)[0];
|
||||
var overrides = (this.args.wrappedJSObject || this.args)[1] || {};
|
||||
if(target instanceof Components.interfaces.nsISupports) {
|
||||
target = new XPCNativeWrapper(target);
|
||||
}
|
||||
var ret = new sandbox.Object();
|
||||
var wrappedRet = ret.wrappedJSObject || ret;
|
||||
wrappedRet.has = function(x, prop) {
|
||||
return overrides.hasOwnProperty(prop) || prop in target;
|
||||
};
|
||||
wrappedRet.get = function(x, prop, receiver) {
|
||||
if (prop === "__wrappedObject") return target;
|
||||
if (prop === "__wrapperOverrides") return overrides;
|
||||
if (prop === "__wrappingManager") return me;
|
||||
var y = overrides.hasOwnProperty(prop) ? overrides[prop] : target[prop];
|
||||
if (y === null || (typeof y !== "object" && typeof y !== "function")) return y;
|
||||
return wrap(y, typeof y === "function" ? function() {
|
||||
var args = Array.prototype.slice.apply(arguments);
|
||||
for (var i = 0; i < args.length; i++) {
|
||||
if (typeof args[i] === "object" && args[i] !== null &&
|
||||
args[i].wrappedJSObject && args[i].wrappedJSObject.__wrappedObject)
|
||||
args[i] = new XPCNativeWrapper(args[i].wrappedJSObject.__wrappedObject);
|
||||
}
|
||||
return wrap(y.apply(target, args));
|
||||
} : new sandbox.Object());
|
||||
};
|
||||
wrappedRet.ownKeys = function(x) {
|
||||
return Components.utils.cloneInto(target.getOwnPropertyNames(), sandbox);
|
||||
};
|
||||
wrappedRet.enumerate = function(x) {
|
||||
var y = new sandbox.Array();
|
||||
for (var i in target) y.wrappedJSObject.push(i);
|
||||
return y;
|
||||
};
|
||||
return ret;
|
||||
});
|
||||
} else {
|
||||
this.wrap = Zotero.Translate.DOMWrapper.wrap;
|
||||
}
|
||||
wrappedRet.get = function(x, prop, receiver) {
|
||||
if (prop === "__wrappedObject") return target;
|
||||
if (prop === "__wrapperOverrides") return overrides;
|
||||
if (prop === "__wrappingManager") return me;
|
||||
var y = overrides.hasOwnProperty(prop) ? overrides[prop] : target[prop];
|
||||
if (y === null || (typeof y !== "object" && typeof y !== "function")) return y;
|
||||
return wrap(y, typeof y === "function" ? function() {
|
||||
var args = Array.prototype.slice.apply(arguments);
|
||||
for (var i = 0; i < args.length; i++) {
|
||||
if (typeof args[i] === "object" && args[i] !== null &&
|
||||
args[i].wrappedJSObject && args[i].wrappedJSObject.__wrappedObject)
|
||||
args[i] = new XPCNativeWrapper(args[i].wrappedJSObject.__wrappedObject);
|
||||
}
|
||||
return wrap(y.apply(target, args));
|
||||
} : new sandbox.Object());
|
||||
};
|
||||
wrappedRet.ownKeys = function(x) {
|
||||
return Components.utils.cloneInto(target.getOwnPropertyNames(), sandbox);
|
||||
};
|
||||
wrappedRet.enumerate = function(x) {
|
||||
var y = new sandbox.Array();
|
||||
for (var i in target) y.wrappedJSObject.push(i);
|
||||
return y;
|
||||
};
|
||||
return ret;
|
||||
});
|
||||
}
|
||||
|
||||
Zotero.Translate.SandboxManager.prototype = {
|
||||
|
@ -490,25 +486,17 @@ Zotero.Translate.SandboxManager.prototype = {
|
|||
var isObject = typeof object[localKey] === "object";
|
||||
if(isFunction || isObject) {
|
||||
if(isFunction) {
|
||||
if (Zotero.platformMajorVersion >= 33) {
|
||||
attachTo[localKey] = this._makeContentForwarder(function() {
|
||||
var args = Array.prototype.slice.apply(this.args.wrappedJSObject || this.args);
|
||||
for(var i = 0; i<args.length; i++) {
|
||||
// Make sure we keep XPCNativeWrappers
|
||||
if(args[i] instanceof Components.interfaces.nsISupports) {
|
||||
args[i] = new XPCNativeWrapper(args[i]);
|
||||
}
|
||||
attachTo[localKey] = this._makeContentForwarder(function() {
|
||||
var args = Array.prototype.slice.apply(this.args.wrappedJSObject || this.args);
|
||||
for(var i = 0; i<args.length; i++) {
|
||||
// Make sure we keep XPCNativeWrappers
|
||||
if(args[i] instanceof Components.interfaces.nsISupports) {
|
||||
args[i] = new XPCNativeWrapper(args[i]);
|
||||
}
|
||||
if(passAsFirstArgument) args.unshift(passAsFirstArgument);
|
||||
return me.copyObject(object[localKey].apply(object, args));
|
||||
});
|
||||
} else {
|
||||
attachTo[localKey] = function() {
|
||||
var args = Array.prototype.slice.apply(arguments);
|
||||
if(passAsFirstArgument) args.unshift(passAsFirstArgument);
|
||||
return me.copyObject(object[localKey].apply(object, args));
|
||||
};
|
||||
}
|
||||
}
|
||||
if(passAsFirstArgument) args.unshift(passAsFirstArgument);
|
||||
return me.copyObject(object[localKey].apply(object, args));
|
||||
});
|
||||
} else {
|
||||
attachTo[localKey] = new sandbox.Object();
|
||||
}
|
||||
|
|
|
@ -1871,7 +1871,7 @@ Zotero.Utilities = {
|
|||
item.setCreator(item.getCreators().length, creator);
|
||||
} else {
|
||||
creator.creatorType = Zotero.CreatorTypes.getName(creatorTypeID);
|
||||
if(Zotero.isFx && !Zotero.isBookmarklet && Zotero.platformMajorVersion >= 32) {
|
||||
if (Zotero.isFx && !Zotero.isBookmarklet) {
|
||||
creator = Components.utils.cloneInto(creator, item);
|
||||
}
|
||||
item.creators.push(creator);
|
||||
|
|
|
@ -1618,15 +1618,6 @@ Components.utils.import("resource://gre/modules/osfile.jsm");
|
|||
.getService(Components.interfaces.nsILocaleService);
|
||||
var appLocale = localeService.getApplicationLocale();
|
||||
|
||||
// Use nsICollation before Fx30
|
||||
if (Zotero.platformMajorVersion < 30) {
|
||||
var localeService = Components.classes["@mozilla.org/intl/nslocaleservice;1"]
|
||||
.getService(Components.interfaces.nsILocaleService);
|
||||
var collationFactory = Components.classes["@mozilla.org/intl/collation-factory;1"]
|
||||
.getService(Components.interfaces.nsICollationFactory);
|
||||
return this.collation = collationFactory.CreateCollation(appLocale);
|
||||
}
|
||||
|
||||
try {
|
||||
var locale = appLocale.getCategory('NSILOCALE_COLLATE');
|
||||
// Extract a valid language tag
|
||||
|
|
|
@ -505,12 +505,4 @@ ZoteroCommandLineHandler.prototype.__defineGetter__("Zotero", function() {
|
|||
return zContext.Zotero;
|
||||
});
|
||||
|
||||
/**
|
||||
* XPCOMUtils.generateNSGetFactory was introduced in Mozilla 2 (Firefox 4).
|
||||
* XPCOMUtils.generateNSGetModule is for Mozilla 1.9.2 (Firefox 3.6).
|
||||
*/
|
||||
if (XPCOMUtils.generateNSGetFactory) {
|
||||
var NSGetFactory = XPCOMUtils.generateNSGetFactory([ZoteroService, ZoteroCommandLineHandler]);
|
||||
} else {
|
||||
var NSGetModule = XPCOMUtils.generateNSGetModule([ZoteroService, ZoteroCommandLineHandler]);
|
||||
}
|
||||
var NSGetFactory = XPCOMUtils.generateNSGetFactory([ZoteroService, ZoteroCommandLineHandler]);
|
||||
|
|
Loading…
Add table
Reference in a new issue