Skip to content

Commit

Permalink
Address compatibility issues with SeaMonkey 2.53.13
Browse files Browse the repository at this point in the history
* Replaced legacy Iterator usage with Object.entries / Symbol.iterator.
* Handle removed parameters of NSIInputStreamInput.input API.
* Bumped up extension version and minimum versions of supported applications.
* Also target Pale Moon, Iceape-UXP and Iceweasel-UXP.

Co-authored-by: dirkf <fieldhouse@gmx.net>
  • Loading branch information
UCyborg and dirkf committed Aug 27, 2022
1 parent 333dd46 commit f2f202f
Show file tree
Hide file tree
Showing 9 changed files with 56 additions and 17 deletions.
2 changes: 1 addition & 1 deletion chrome/content/common/internalFunctions.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ var Exception = Components.Exception;

Cu.import("chrome://dta-modules/content/glue.jsm", this);
(function() {
for (let [k,v] in new Iterator(require("constants"))) {
for (let [k,v] of Object.entries(require("constants"))) {
Object.defineProperty(this, k, {value: v, enumerable:true});
}
}).call(this);
Expand Down
4 changes: 2 additions & 2 deletions chrome/content/dta/manager/manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -2017,7 +2017,7 @@ var QueueItem = class QueueItem {
if (isNaN(size) || size < 0) {
if (log.enabled) {
log(LOG_ERROR, "Bug: invalid partial size!", size);
for (let [i,c] in Iterator(this.chunks)) {
for (let [i,c] of Object.entries(this.chunks)) {
log(LOG_DEBUG, "Chunk " + i + ": " + c);
}
}
Expand Down Expand Up @@ -2717,7 +2717,7 @@ var QueueItem = class QueueItem {
}
let scoreboard = "";
let len = this.totalSize.toString().length;
for (let [i,c] in Iterator(this.chunks)) {
for (let [i,c] of Object.entries(this.chunks)) {
scoreboard += i + ": " + c + "\n";
}
log(LOG_DEBUG, "scoreboard\n" + scoreboard);
Expand Down
2 changes: 1 addition & 1 deletion chrome/content/dta/manager/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -688,7 +688,7 @@ var Tooltip = {

let bl = b.length;
for (let pass of this._ucPasses) {
for (var [i, chunk] in Iterator(b)) {
for (let [i, chunk] of Object.entries(b)) {
if (pass.fs) {
ctx.fillStyle = this._createInnerShadowGradient(ctx, cheight, pass.fs);
}
Expand Down
35 changes: 31 additions & 4 deletions install.rdf
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<em:id>dta@downthemall.net</em:id>
<em:name>DownThemAll!</em:name>
<em:description>The mass downloader for Firefox.</em:description>
<em:version>3.1.1pre</em:version>
<em:version>3.1.2pre</em:version>
<em:bootstrap>true</em:bootstrap>
<em:multiprocessCompatible>true</em:multiprocessCompatible>
<em:type>2</em:type>
Expand All @@ -26,17 +26,44 @@
<em:targetApplication>
<Description>
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
<em:minVersion>45.0</em:minVersion>
<em:minVersion>47.0</em:minVersion>
<em:maxVersion>56.*</em:maxVersion>
</Description>
</em:targetApplication>

<!-- Seamonkey -->
<!-- SeaMonkey -->
<em:targetApplication>
<Description>
<em:id>{92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a}</em:id>
<em:minVersion>2.40</em:minVersion>
<em:maxVersion>2.53.12.*</em:maxVersion>
<em:maxVersion>2.53.*</em:maxVersion>
</Description>
</em:targetApplication>

<!-- Pale Moon -->
<em:targetApplication>
<Description>
<em:id>{8de7fcbb-c55c-4fbe-bfc5-fc555c87dbc4}</em:id>
<em:minVersion>28.0.0</em:minVersion>
<em:maxVersion>31.*</em:maxVersion>
</Description>
</em:targetApplication>

<!-- Iceape-UXP -->
<em:targetApplication>
<Description>
<em:id>{9184b6fe-4a5c-484d-8b4b-efbfccbfb514}</em:id>
<em:minVersion>52.9.0</em:minVersion>
<em:maxVersion>52.*</em:maxVersion>
</Description>
</em:targetApplication>

<!-- Iceweasel-UXP -->
<em:targetApplication>
<Description>
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
<em:minVersion>52.9.0</em:minVersion>
<em:maxVersion>52.*</em:maxVersion>
</Description>
</em:targetApplication>

Expand Down
2 changes: 1 addition & 1 deletion modules/api.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ let wrap = (_k, _v) => {
};
};

for (let [k,v] in Iterator(api)) {
for (let [k,v] of Object.entries(api)) {
let [_k,_v] = [k,v];
Object.defineProperty(this, _k, {
get: wrap(_k, _v),
Expand Down
22 changes: 17 additions & 5 deletions modules/manager/verificator.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,17 @@ function _verify(file, hashCollection, progressCallback) {
}
const stream = new Instances.FileInputStream(file, flags, 502 /* 0766*/, 0);

const getInputStreamPump = function(stream, seg_size, seg_num, flag) {
// see modules/glue.jsm:149 for prefix Plain to instantiate w/o init
let pump = new Instances.PlainInputStreamPump();
if (pump.init.length > 5) {
pump.init(stream, 0, -1, seg_size, seg_num, flag);
} else {
pump.init(stream, seg_size, seg_num, flag);
}
return pump;
}

return new Promise(function(resolve, reject) {
const listener = {
QueryInterface: QI([Ci.nsIStreamListener, Ci.nsIRequestObserver]),
Expand Down Expand Up @@ -53,7 +64,7 @@ function _verify(file, hashCollection, progressCallback) {
progressCallback(Math.min(completed, total));
}
};
let pump = new Instances.InputStreamPump(stream, 0, -1, SEGSIZE, SEGNUM, false);
let pump = getInputStreamPump(stream, SEGSIZE, SEGNUM, false);
pump.asyncRead(listener, null);
}.bind(this));
}
Expand All @@ -72,8 +83,8 @@ function _multiVerify(file, hashCollection, progressCallback) {
log(LOG_DEBUG, "enabled OS_READAHEAD");
}
let stream = new Instances.FileInputStream(file, flags, 502 /* 0766 */, 0).QueryInterface(Ci.nsISeekableStream);
let partials = new Iterator(hashCollection.partials);
let partial = partials.next()[1];
let partials = hashCollection.partials[Symbol.iterator]();
let partial = partials.next().value[1];
log(LOG_DEBUG, partial.toSource());
let partialHash = new Instances.Hash(nsICryptoHash[partial.type]);
let partialPending = hashCollection.parLength;
Expand Down Expand Up @@ -170,8 +181,9 @@ function _multiVerify(file, hashCollection, progressCallback) {
}
};
let tee = new Instances.StreamListenerTee(listenerMain, po);
new Instances.InputStreamPump(stream, 0, -1, SEGSIZE, SEGNUM, false).asyncRead(tee, null);
new Instances.InputStreamPump(pi, 0, -1, SEGSIZE, SEGNUM, true).asyncRead(listenerPartials, null);
getInputStreamPump(stream, SEGSIZE, SEGNUM, false).asyncRead(tee, null);
getInputStreamPump(pi, SEGSIZE, SEGNUM, true).asyncRead(listenerPartials, null);

}.bind(this));
}

Expand Down
2 changes: 1 addition & 1 deletion modules/manager/visitormanager.js
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ class VisitorManager {
* if no timestamp found
*/
get time() {
for (let [,v] in new Iterator(this._visitors)) {
for (let [,v] of Object.entries(this._visitors)) {
if (v.time && v.time > 0) {
return v.time;
}
Expand Down
2 changes: 1 addition & 1 deletion modules/support/filtermanager.js
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,7 @@ class FilterManagerImpl {

// Load all
let all = [];
for (let [id, obj] in Iterator(filters)) {
for (let [id, obj] of Object.entries(filters)) {
try {
let f = new Filter(id);
f.load(obj);
Expand Down
2 changes: 1 addition & 1 deletion modules/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ naturalSort.strtol = function strtol(str, rv) {
str.toLowerCase().split(""),
e => e.charCodeAt(0)
);
for (let [idx,c] in new Iterator(chars)) {
for (let [idx,c] of Object.entries(chars)) {
if ((c >= 48 && c <= 57) || (base === 16 && c >= 97 && c <= 100)) {
continue;
}
Expand Down

0 comments on commit f2f202f

Please sign in to comment.