Remove some code that's unnecessary now that we're Fx52+ everywhere

This commit is contained in:
Dan Stillman 2017-06-23 04:59:48 -04:00
parent ef1715e9ee
commit e89778c1ab
7 changed files with 17 additions and 63 deletions

View file

@ -1137,9 +1137,6 @@ Zotero.Item.prototype.removeCreator = function(orderIndex, allowMissing) {
// Define boolean properties
for (let name of ['deleted', 'inPublications']) {
let prop = '_' + name;
// Fix for https://bugzilla.mozilla.org/show_bug.cgi?id=449811 (Fixed in Fx51)
let tmpName = name;
Zotero.defineProperty(Zotero.Item.prototype, name, {
get: function() {
if (!this.id) {
@ -1154,12 +1151,12 @@ for (let name of ['deleted', 'inPublications']) {
val = !!val;
if (this[prop] == val) {
Zotero.debug(Zotero.Utilities.capitalize(tmpName)
Zotero.debug(Zotero.Utilities.capitalize(name)
+ " state hasn't changed for item " + this.id);
return;
}
this._markFieldChange(tmpName, !!this[prop]);
this._changed[tmpName] = true;
this._markFieldChange(name, !!this[prop]);
this._changed[name] = true;
this[prop] = val;
}
});

View file

@ -115,10 +115,7 @@ Zotero.Debug = new function () {
slowSuffix = "\x1b[0m";
}
// TODO: Replace with String.prototype.padStart once available (Fx48)
while (("" + delta).length < 7) {
delta = '0' + delta;
}
delta = ("" + delta).padStart(7, "0")
deltaStr = "(" + slowPrefix + "+" + delta + slowSuffix + ")";
if (_store) {

View file

@ -338,8 +338,6 @@ Zotero.HTTP = new function() {
var useMethodjit = Components.utils.methodjit;
/** @ignore */
xmlhttp.onreadystatechange = function() {
// XXX Remove when we drop support for Fx <24
if(useMethodjit !== undefined) Components.utils.methodjit = useMethodjit;
_stateChange(xmlhttp, onDone, responseCharset);
};
@ -424,8 +422,6 @@ Zotero.HTTP = new function() {
var useMethodjit = Components.utils.methodjit;
/** @ignore */
xmlhttp.onreadystatechange = function() {
// XXX Remove when we drop support for Fx <24
if(useMethodjit !== undefined) Components.utils.methodjit = useMethodjit;
_stateChange(xmlhttp, onDone, responseCharset);
};
@ -486,8 +482,6 @@ Zotero.HTTP = new function() {
var useMethodjit = Components.utils.methodjit;
/** @ignore */
xmlhttp.onreadystatechange = function() {
// XXX Remove when we drop support for Fx <24
if(useMethodjit !== undefined) Components.utils.methodjit = useMethodjit;
_stateChange(xmlhttp, onDone);
};
@ -523,8 +517,6 @@ Zotero.HTTP = new function() {
var useMethodjit = Components.utils.methodjit;
/** @ignore */
xmlhttp.onreadystatechange = function() {
// XXX Remove when we drop support for Fx <24
if(useMethodjit !== undefined) Components.utils.methodjit = useMethodjit;
_stateChange(xmlhttp, callback);
};
xmlhttp.send(null);
@ -696,8 +688,6 @@ Zotero.HTTP = new function() {
var useMethodjit = Components.utils.methodjit;
/** @ignore */
xmlhttp.onreadystatechange = function() {
// XXX Remove when we drop support for Fx <24
if(useMethodjit !== undefined) Components.utils.methodjit = useMethodjit;
_stateChange(xmlhttp, callback);
};
xmlhttp.send(null);
@ -733,8 +723,6 @@ Zotero.HTTP = new function() {
var useMethodjit = Components.utils.methodjit;
/** @ignore */
xmlhttp.onreadystatechange = function() {
// XXX Remove when we drop support for Fx <24
if(useMethodjit !== undefined) Components.utils.methodjit = useMethodjit;
_stateChange(xmlhttp, callback);
};
xmlhttp.send(null);

View file

@ -502,24 +502,16 @@ Zotero.Proxies = new function() {
* @return {Object} Object containing the content browser as 'browser' and a ChromeWindow as 'window'
*/
function _getBrowserAndWindow(channel) {
// Firefox 45 and earlier
if (Zotero.platformMajorVersion < 46) {
var browser = channel.notificationCallbacks.getInterface(Ci.nsIWebNavigation)
.QueryInterface(Ci.nsIDocShell).chromeEventHandler;
}
// Firefox 46 and up (non-e10s)
else {
let outerWindowID = channel.loadInfo.outerWindowID;
var wm = Cc["@mozilla.org/appshell/window-mediator;1"]
.getService(Ci.nsIWindowMediator);
let outerContentWin = wm.getOuterWindowWithId(outerWindowID);
if (!outerContentWin) {
return { browser: null, window: null };
}
var browser = outerContentWin.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebNavigation)
.QueryInterface(Ci.nsIDocShell).chromeEventHandler;
let outerWindowID = channel.loadInfo.outerWindowID;
var wm = Cc["@mozilla.org/appshell/window-mediator;1"]
.getService(Ci.nsIWindowMediator);
let outerContentWin = wm.getOuterWindowWithId(outerWindowID);
if (!outerContentWin) {
return { browser: null, window: null };
}
var browser = outerContentWin.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebNavigation)
.QueryInterface(Ci.nsIDocShell).chromeEventHandler;
return {
browser,
window: browser.ownerDocument.defaultView

View file

@ -1598,8 +1598,7 @@ var ZoteroPane = new function()
*/
this.updateItemPaneButtons = function (selectedItems) {
if (!selectedItems.length) {
// TODO: Remove Array.from after Firefox 45 support is removed
Array.from(document.querySelectorAll('.zotero-item-pane-top-buttons')).forEach(x => x.hidden = true);
document.querySelectorAll('.zotero-item-pane-top-buttons').forEach(x => x.hidden = true);
return;
}

View file

@ -218,14 +218,7 @@ describe("Zotero.DataDirectory", function () {
return Zotero.Promise.reject(new Error("Error"));
}
else {
let args;
if (Zotero.platformMajorVersion < 46) {
args = Array.from(arguments);
}
else {
args = arguments;
}
return origFunc(...args);
return origFunc(...arguments);
}
});
let stub1 = sinon.stub(Zotero.File, "reveal").returns(Zotero.Promise.resolve());
@ -401,14 +394,7 @@ describe("Zotero.DataDirectory", function () {
return Zotero.Promise.reject(new Error("Error"));
}
else {
let args;
if (Zotero.platformMajorVersion < 46) {
args = Array.from(arguments);
}
else {
args = arguments;
}
return origFunc(...args);
return origFunc(...arguments);
}
});

View file

@ -1039,12 +1039,7 @@ describe("Zotero.Sync.Runner", function () {
win = yield loadZoteroPane();
var doc = win.document;
if (Zotero.platformMajorVersion >= 48) {
var text = "".padStart(256, "a");
}
else {
var text = Array(256).fill("a").join("");
}
var text = "".padStart(256, "a");
var item = yield createDataObject('item', { itemType: 'note', note: text });
setResponse('keyInfo.fullAccess');