Guard browser OPFS custom session path helper

This commit is contained in:
2026-06-13 23:34:42 +08:00
parent baf187e11c
commit 4f174cb0c2
2 changed files with 81 additions and 14 deletions

View File

@@ -4545,6 +4545,16 @@
return opfsPath;
}
function opfsCustomSessionPaths(machineId, parameterFilename, toolTableFilename, wasmPaths) {
return {
opfs: {
parameters: opfsMachineFilePath(machineId, parameterFilename),
toolTable: opfsMachineFilePath(machineId, toolTableFilename),
},
wasm: wasmPaths,
};
}
function assertOpfsSessionStaging(label, session, machineId, expectedPaths) {
if (session.machineId !== machineId) {
throw new Error(`${label}: unexpected machine id ${session.machineId}`);
@@ -9426,17 +9436,16 @@
"opfs_load_ini_named_session_staging",
loadedIniFileSession,
"browser-ini-file-session",
{
opfs: {
parameters: "linuxcnc/machines/browser-ini-file-session/browser-custom.var",
toolTable: "linuxcnc/machines/browser-ini-file-session/browser-custom-tool.tbl",
},
wasm: {
opfsCustomSessionPaths(
"browser-ini-file-session",
"browser-custom.var",
"browser-custom-tool.tbl",
{
ini: "/work/browser-ini-file-session.ini",
parameters: "/work/browser-custom.var",
toolTable: "/work/browser-custom-tool.tbl",
},
},
),
);
verifyExpectedOutput(
"opfs_load_ini_named_parameter_file",
@@ -9601,17 +9610,16 @@
"opfs_load_explicit_session_staging",
loadedIniOverrideSession,
"browser-ini-override-session",
{
opfs: {
parameters: "linuxcnc/machines/browser-ini-override-session/browser-explicit.var",
toolTable: "linuxcnc/machines/browser-ini-override-session/browser-explicit-tool.tbl",
},
wasm: {
opfsCustomSessionPaths(
"browser-ini-override-session",
"browser-explicit.var",
"browser-explicit-tool.tbl",
{
ini: "/work/browser-ini-override-session.ini",
parameters: "/work/browser-explicit.var",
toolTable: "/work/browser-explicit-tool.tbl",
},
},
),
);
verifyExpectedOutput(
"opfs_load_explicit_parameter_file",