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 // Define boolean properties
for (let name of ['deleted', 'inPublications']) { for (let name of ['deleted', 'inPublications']) {
let prop = '_' + name; 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, { Zotero.defineProperty(Zotero.Item.prototype, name, {
get: function() { get: function() {
if (!this.id) { if (!this.id) {
@ -1154,12 +1151,12 @@ for (let name of ['deleted', 'inPublications']) {
val = !!val; val = !!val;
if (this[prop] == 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); + " state hasn't changed for item " + this.id);
return; return;
} }
this._markFieldChange(tmpName, !!this[prop]); this._markFieldChange(name, !!this[prop]);
this._changed[tmpName] = true; this._changed[name] = true;
this[prop] = val; this[prop] = val;
} }
}); });

View file

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

View file

@ -338,8 +338,6 @@ Zotero.HTTP = new function() {
var useMethodjit = Components.utils.methodjit; var useMethodjit = Components.utils.methodjit;
/** @ignore */ /** @ignore */
xmlhttp.onreadystatechange = function() { xmlhttp.onreadystatechange = function() {
// XXX Remove when we drop support for Fx <24
if(useMethodjit !== undefined) Components.utils.methodjit = useMethodjit;
_stateChange(xmlhttp, onDone, responseCharset); _stateChange(xmlhttp, onDone, responseCharset);
}; };
@ -424,8 +422,6 @@ Zotero.HTTP = new function() {
var useMethodjit = Components.utils.methodjit; var useMethodjit = Components.utils.methodjit;
/** @ignore */ /** @ignore */
xmlhttp.onreadystatechange = function() { xmlhttp.onreadystatechange = function() {
// XXX Remove when we drop support for Fx <24
if(useMethodjit !== undefined) Components.utils.methodjit = useMethodjit;
_stateChange(xmlhttp, onDone, responseCharset); _stateChange(xmlhttp, onDone, responseCharset);
}; };
@ -486,8 +482,6 @@ Zotero.HTTP = new function() {
var useMethodjit = Components.utils.methodjit; var useMethodjit = Components.utils.methodjit;
/** @ignore */ /** @ignore */
xmlhttp.onreadystatechange = function() { xmlhttp.onreadystatechange = function() {
// XXX Remove when we drop support for Fx <24
if(useMethodjit !== undefined) Components.utils.methodjit = useMethodjit;
_stateChange(xmlhttp, onDone); _stateChange(xmlhttp, onDone);
}; };
@ -523,8 +517,6 @@ Zotero.HTTP = new function() {
var useMethodjit = Components.utils.methodjit; var useMethodjit = Components.utils.methodjit;
/** @ignore */ /** @ignore */
xmlhttp.onreadystatechange = function() { xmlhttp.onreadystatechange = function() {
// XXX Remove when we drop support for Fx <24
if(useMethodjit !== undefined) Components.utils.methodjit = useMethodjit;
_stateChange(xmlhttp, callback); _stateChange(xmlhttp, callback);
}; };
xmlhttp.send(null); xmlhttp.send(null);
@ -696,8 +688,6 @@ Zotero.HTTP = new function() {
var useMethodjit = Components.utils.methodjit; var useMethodjit = Components.utils.methodjit;
/** @ignore */ /** @ignore */
xmlhttp.onreadystatechange = function() { xmlhttp.onreadystatechange = function() {
// XXX Remove when we drop support for Fx <24
if(useMethodjit !== undefined) Components.utils.methodjit = useMethodjit;
_stateChange(xmlhttp, callback); _stateChange(xmlhttp, callback);
}; };
xmlhttp.send(null); xmlhttp.send(null);
@ -733,8 +723,6 @@ Zotero.HTTP = new function() {
var useMethodjit = Components.utils.methodjit; var useMethodjit = Components.utils.methodjit;
/** @ignore */ /** @ignore */
xmlhttp.onreadystatechange = function() { xmlhttp.onreadystatechange = function() {
// XXX Remove when we drop support for Fx <24
if(useMethodjit !== undefined) Components.utils.methodjit = useMethodjit;
_stateChange(xmlhttp, callback); _stateChange(xmlhttp, callback);
}; };
xmlhttp.send(null); 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' * @return {Object} Object containing the content browser as 'browser' and a ChromeWindow as 'window'
*/ */
function _getBrowserAndWindow(channel) { function _getBrowserAndWindow(channel) {
// Firefox 45 and earlier let outerWindowID = channel.loadInfo.outerWindowID;
if (Zotero.platformMajorVersion < 46) { var wm = Cc["@mozilla.org/appshell/window-mediator;1"]
var browser = channel.notificationCallbacks.getInterface(Ci.nsIWebNavigation) .getService(Ci.nsIWindowMediator);
.QueryInterface(Ci.nsIDocShell).chromeEventHandler; let outerContentWin = wm.getOuterWindowWithId(outerWindowID);
} if (!outerContentWin) {
// Firefox 46 and up (non-e10s) return { browser: null, window: null };
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;
} }
var browser = outerContentWin.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebNavigation)
.QueryInterface(Ci.nsIDocShell).chromeEventHandler;
return { return {
browser, browser,
window: browser.ownerDocument.defaultView window: browser.ownerDocument.defaultView

View file

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

View file

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

View file

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