fix(diag): v3.26.119 修导出诊断 JSON(未定义全局)+ 解码位图按真实尺寸估算 + 失效引用不再重试
This commit is contained in:
1 parent
6256185d90
commit
db55d451df
7 files changed
+59
-21
No files matched your search
@@ -13,6 +13,10 @@
|
||||
;(function (global) {
|
||||
'use strict'
|
||||
const done = new WeakSet()
|
||||
// v3.26.119:读不出来的 {__cache} 键记下来 —— 桌面端没有 Service Worker 直出,
|
||||
// 这类引用(网页版留下的)**永远**读不到。原来每次加载画板都重试一轮(日志里
|
||||
// `cache-migrate ok=0 fail=4` 从早刷到晚),纯浪费 I/O,也让人误以为「还在迁移」。
|
||||
const failedKeys = new Set()
|
||||
|
||||
// 收集所有 {__cache} 引用对象(引用本身是可变对象,直接原地改)
|
||||
function collect (value, out) {
|
||||
@@ -38,6 +42,7 @@
|
||||
return { total: refs.length, ok: ok, fail: fail }
|
||||
}
|
||||
const ref = refs[i]
|
||||
if (failedKeys.has(ref.__cache)) { fail++; return step(i + 1) }
|
||||
return Promise.resolve()
|
||||
.then(() => d.read(ref.__cache))
|
||||
.then((dataUrl) => (dataUrl ? d.write(dataUrl) : null))
|
||||
@@ -46,13 +51,14 @@
|
||||
delete ref.__cache
|
||||
Object.assign(ref, next)
|
||||
ok++
|
||||
} else { fail++ }
|
||||
} else { failedKeys.add(ref.__cache); fail++ }
|
||||
})
|
||||
.catch(() => { fail++ })
|
||||
.catch(() => { failedKeys.add(ref.__cache); fail++ })
|
||||
.then(() => step(i + 1))
|
||||
}
|
||||
return Promise.resolve().then(() => step(0)).catch(() => ({ total: refs.length, ok: ok, fail: fail }))
|
||||
}
|
||||
|
||||
global.IWBImageCacheMigrate = { once: once, _collect: collect }
|
||||
function failedCount () { return failedKeys.size }
|
||||
global.IWBImageCacheMigrate = { once: once, _collect: collect, failedCount: failedCount }
|
||||
})(typeof window !== 'undefined' ? window : globalThis)
|
||||
Reference in new issue
Block a user