test(hls): [PKG-HLS-SDK-01] capture scoped Firefox native exceptions

This commit is contained in:
Harvey Zhao committed 2026-09-15 17:33:49 +08:00
1 parent e0c5cf27de
commit 2802cbacc5
14 files changed
+26842 -4

No files matched your search

@@ -0,0 +1,25 @@
import path from 'node:path'
// Require a live, unchanged runner and a complete creation-ordered ancestry chain.
export function selectFirefoxProcesses(rows, root, executable) {
const samePath = value => typeof value === 'string' && path.win32.normalize(value).toLowerCase() === path.win32.normalize(executable).toLowerCase()
const byId = new Map(rows.map(row => [row.pid, row]))
const currentRoot = byId.get(root.pid)
if (!currentRoot || !Number.isFinite(Date.parse(root.created)) || currentRoot.created !== root.created || currentRoot.executable !== root.executable)
return []
return rows.filter((row) => {
if (row.pid === root.pid || !samePath(row.executable))
return false
const seen = new Set([row.pid])
let child = row
while (child.parent !== root.pid) {
const parent = byId.get(child.parent)
if (!parent || seen.has(parent.pid) || !samePath(parent.executable) || !Number.isFinite(Date.parse(parent.created)) || Date.parse(parent.created) > Date.parse(child.created))
return false
seen.add(parent.pid)
child = parent
}
return Number.isFinite(Date.parse(row.created)) && Number.isFinite(Date.parse(child.created))
&& Date.parse(child.created) >= Date.parse(root.created)
})
}