Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code from 3.0.9 release #303

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ DownThemAll! as a whole is licensed under GPL 2.0. See the GPL file.

Individual files may have additional and/or different licenses.
See the corresponding repository files available from
<https://code.downthemall.net/repos/>
<https://github.com/downthemall/downthemall-legacy>
Most files are licensed under the GPL/LGPL-compatible MPL 2.0, or are
tri-licensed under a MPL 1.1/GPL 2.0/LGPL 2.1 license.
See the MPL, GPL, LGPL files respectively.
Expand Down
8 changes: 4 additions & 4 deletions chrome/content/common/bindings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -703,9 +703,9 @@
<constructor><![CDATA[
function doAfterPaint(i) {
i = i || 8; // recalculate a few times here, as the bg images might be loaded asynchronously
window.addEventListener("MozAfterPaint", function paint() {
window.addEventListener("MozAfterPaint", function() {
if (--i == 0) {
window.removeEventListener("MozAfterPaint", paint, false);
window.removeEventListener("MozAfterPaint", arguments.callee, false);
}
try {
_rl();
Expand Down Expand Up @@ -774,7 +774,7 @@
let idata = ctx.getImageData(0, 0, canvas.width, canvas.height).data;

// recursively extrapolate the best color
return (function reccolor(ref, l) {
return (function(ref, l) {
l = l || 0;
if (l > 4) {
return ref;
Expand Down Expand Up @@ -805,7 +805,7 @@
if (l && poorMansSimilarity(newRef, ref) < 5) {
return newRef;
}
return reccolor(newRef, ++l);
return arguments.callee(newRef, ++l);
})();
}

Expand Down
36 changes: 17 additions & 19 deletions chrome/content/common/internalFunctions.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

/* dTa-only code! - DO NOT include in overlays or such! */
"use strict";
/* jshint browser:true */
/* global _, Cc:true, Ci:true, Cu:true, Cr:true, ctor:true, Exception:true */
/* jshint strict:true, globalstrict:true, browser:true */
/* global _, Cc:true, Ci:true, Cr:true, Cu:true, ctor:true, Exception:true */
var Cc = Components.classes;
var Ci = Components.interfaces;
var Cr = Components.results;
Expand Down Expand Up @@ -48,8 +48,7 @@ var getLargeIcon = (function() {
var getFavIcon = (function() {
const RE_HTML = /html?$|aspx?$|php\d?$|py$|\/[^.]*$/i;
return function getFavIcon(uri, cb, tp) {
const path = uri.path || uri.pathQueryRef;
if (!RE_HTML.test(path)) {
if (!RE_HTML.test(uri.path)) {
cb.call(tp, getIcon(uri), false);
return;
}
Expand All @@ -65,18 +64,18 @@ var getFavIcon = (function() {
* @return Either the element when there was just one parameter, or an array of
* elements.
*/
function $(...args) {
if (args.length === 1) {
return document.getElementById(args[0]);
function $() {
if (arguments.length === 1) {
return document.getElementById(arguments[0]);
}
let elements = [];
for (let i = 0, e = args.length; i < e; ++i) {
let element = document.getElementById(args[i]);
for (let i = 0, e = arguments.length; i < e; ++i) {
let element = document.getElementById(arguments[i]);
if (element) {
elements.push(element);
}
else {
log(LOG_ERROR, "requested a non-existing element: " + args[i]);
log(LOG_ERROR, "requested a non-existing element: " + arguments[i]);
}
}
return elements;
Expand Down Expand Up @@ -207,7 +206,7 @@ var Utils = {
if (!isFinite(aNumber)) {
return 'NaN';
}
return _('sizeKB', [aNumber.toFixed(decimalPlace || 1)]);
return _('sizeKB', [aNumber.toFixed(arguments.length > 1 ? decimalPlace : 1)]);
},

formatConflictName: function(basename, conflicts) {
Expand All @@ -228,8 +227,7 @@ var Utils = {
const sunits = units;
const nunits = sunits.length;
const s = scale;
const {memoize} = require("support/memoize");
return memoize(function(val, decimalPlace) {
return function(val, decimalPlace) {
var rv = val;
if (!isFinite(rv)) {
return 'NaN';
Expand All @@ -239,9 +237,9 @@ var Utils = {
rv /= 1024;
}
const unit = sunits[i];
decimalPlace = isFinite(decimalPlace) ? decimalPlace : unit[1];
decimalPlace = arguments.length > 1 ? decimalPlace : unit[1];
return _(unit[0], [rv.toFixed(decimalPlace)], unit[2] && Math.floor(rv));
}, 50);
};
}
Utils.formatBytes = createFormatter(
[['sizeB.2', 0, true], ['sizeKB', 1], ['sizeMB', 2], ['sizeGB', 2], ['sizeTB', 3]],
Expand All @@ -268,11 +266,11 @@ requireJoined(Utils, "support/stringfuncs");
*/
XPCOMUtils.defineLazyGetter(window, "_", function() {
let bundles = new Utils.StringBundles(document);
return function(...args) {
if (args.length === 1) {
return bundles.getString(args[0]);
return function() {
if (arguments.length === 1) {
return bundles.getString(arguments[0]);
}
return bundles.getFormattedString(...args);
return bundles.getFormattedString.apply(bundles, arguments);
};
});

Expand Down
5 changes: 4 additions & 1 deletion chrome/content/dta/manager/conflicts.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
/* jshint browser:true */
/* jshint browser:true, globalstrict:true, strict:false */
/* global _, $ */

function load() {
Expand All @@ -24,3 +24,6 @@ function accept() {
}
return false;
}
opener.addEventListener("unload", function unloadOpener() {
opener.removeEventListener("unload", unloadOpener, false);
}, false);
3 changes: 3 additions & 0 deletions chrome/content/dta/manager/info.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
/* jshint strict:true, globalstrict:true, browser:true */

var {defer} = require("support/defer");
var {TimerManager} = require("support/timers");
var Timers = new TimerManager();

function discard() {
if (opener) {
Expand Down Expand Up @@ -184,6 +186,7 @@ var Dialog = {
},
unload: function() {
Tooltip.stop();
Timers.killAllTimers();
return true;
},
browseDir: function() {
Expand Down
Loading