mirror of
https://github.com/9001/copyparty.git
synced 2025-08-17 17:12:13 -06:00
chrome gets stuck iterating over aux.h on win10
This commit is contained in:
parent
87200d9f10
commit
664f53b75d
|
@ -598,14 +598,50 @@ function up2k_init(subtle) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function read_dirs(rd, pf, dirs, good, bad) {
|
function rd_flatten(pf, dirs) {
|
||||||
|
var ret = jcp(pf);
|
||||||
|
for (var a = 0; a < dirs.length; a++)
|
||||||
|
ret.push(dirs.fullPath || '');
|
||||||
|
|
||||||
|
ret.sort();
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
var rd_missing_ref = [];
|
||||||
|
function read_dirs(rd, pf, dirs, good, bad, spins) {
|
||||||
|
spins = spins || 0;
|
||||||
|
if (++spins == 5)
|
||||||
|
rd_missing_ref = rd_flatten(pf, dirs);
|
||||||
|
|
||||||
|
if (spins == 200) {
|
||||||
|
var missing = rd_flatten(pf, dirs),
|
||||||
|
match = rd_missing_ref.length == missing.length,
|
||||||
|
aa = match ? missing.length : 0;
|
||||||
|
|
||||||
|
missing.sort();
|
||||||
|
for (var a = 0; a < aa; a++)
|
||||||
|
if (rd_missing_ref[a] != missing[a])
|
||||||
|
match = false;
|
||||||
|
|
||||||
|
if (match) {
|
||||||
|
var msg = ['directory iterator got stuck on the following {0} items; good chance your browser is about to spinlock:'.format(missing.length)];
|
||||||
|
for (var a = 0; a < Math.min(20, missing.length); a++)
|
||||||
|
msg.push(missing[a]);
|
||||||
|
|
||||||
|
alert(msg.join('\n-- '));
|
||||||
|
dirs = [];
|
||||||
|
pf = [];
|
||||||
|
}
|
||||||
|
spins = 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (!dirs.length) {
|
if (!dirs.length) {
|
||||||
if (!pf.length)
|
if (!pf.length)
|
||||||
return gotallfiles(good, bad);
|
return gotallfiles(good, bad);
|
||||||
|
|
||||||
console.log("retry pf, " + pf.length);
|
console.log("retry pf, " + pf.length);
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
read_dirs(rd, pf, dirs, good, bad);
|
read_dirs(rd, pf, dirs, good, bad, spins);
|
||||||
}, 50);
|
}, 50);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -645,7 +681,7 @@ function up2k_init(subtle) {
|
||||||
dirs.shift();
|
dirs.shift();
|
||||||
rd = null;
|
rd = null;
|
||||||
}
|
}
|
||||||
return read_dirs(rd, pf, dirs, good, bad);
|
return read_dirs(rd, pf, dirs, good, bad, spins);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -389,6 +389,11 @@ function has(haystack, needle) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function jcp(obj) {
|
||||||
|
return JSON.parse(JSON.stringify(obj));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function sread(key) {
|
function sread(key) {
|
||||||
if (window.localStorage)
|
if (window.localStorage)
|
||||||
return localStorage.getItem(key);
|
return localStorage.getItem(key);
|
||||||
|
|
Loading…
Reference in a new issue