diff --git a/tools/code-coverage/tests/xpcshell/head.js b/tools/code-coverage/tests/xpcshell/head.js index 047605783cf8..563b5bfe3554 100644 --- a/tools/code-coverage/tests/xpcshell/head.js +++ b/tools/code-coverage/tests/xpcshell/head.js @@ -33,6 +33,8 @@ function diffFiles(files_after, files_before) { return files_after.filter(file => !files_before_set.has(file.leafName)); } +const BASENAME_RE = new RegExp("([^/\\\\]+)$"); + function parseRecords(files) { let records = new Map(); @@ -73,12 +75,24 @@ function parseRecords(files) { } case "SF": { - if (AppConstants.platform == "win") { - recordContent = recordContent.replace(/\//g, "\\"); + if ( + recordContent.startsWith("resource:") || + recordContent.startsWith("chrome:") + ) { + recordContent = recordContent.split("/").at(-1); + } else { + if (AppConstants.platform == "win") { + recordContent = recordContent.replace(/\//g, "\\"); + } + const match = BASENAME_RE.exec(recordContent); + if (match.length) { + recordContent = match[0]; + } } currentSF = []; - records.set(PathUtils.filename(recordContent), currentSF); + + records.set(recordContent, currentSF); break; } } diff --git a/tools/code-coverage/tests/xpcshell/xpcshell.ini b/tools/code-coverage/tests/xpcshell/xpcshell.ini index 989680ebbb05..93f756be8bd0 100644 --- a/tools/code-coverage/tests/xpcshell/xpcshell.ini +++ b/tools/code-coverage/tests/xpcshell/xpcshell.ini @@ -4,6 +4,4 @@ support-files = support.js [test_basic.js] -skip-if = - ccov #Bug 1783416 [test_basic_child_and_parent.js]