فینورا پرو - سامانه جامع حسابداری و صدور فاکتور

test(a01): native WebView2 double-click and stale nested confirm rejection

davoodmehraban89 committed Oct 31, 2026 at 06:51 UTC 5b3de2ed8c0168a4323b96c5c9dce5029ddc6ab7
1 file changed +31 -2
tests/windows-vm-ui-interaction-audit-browser.js
+31 -2
@@ -283,10 +283,38 @@
283 const confirmDialog=FINORA.Modal.stack[FINORA.Modal.stack.length-1]?.card;
284 const confirmClick=confirmDialog?.querySelector('[data-action="confirm"]');
285 if(!confirmClick)throw Error('synthetic Confirm action missing');
286 - confirmClick.click();await wait(25);
286 + confirmClick.click();
287 + confirmClick.click(); // old DOM reference must not execute twice
288 + await wait(25);
289 if(syntheticConfirmed!==1 || FINORA.Modal.stack.length){
290 throw Error('synthetic Confirm callback not exactly once or dialog not dismissed');
291 }
292 + FINORA.Modal.confirm({title:'Q01 stale cancelled confirmation',
293 + message:'Must never commit after cancellation',onConfirm:()=>{syntheticConfirmed++;}});
294 + await wait(25);
295 + const staleCancelDialog=FINORA.Modal.stack[FINORA.Modal.stack.length-1]?.card;
296 + const staleConfirm=staleCancelDialog?.querySelector('[data-action="confirm"]');
297 + staleCancelDialog?.querySelector('[data-action="cancel"]')?.click();
298 + staleConfirm?.click();
299 + if(syntheticConfirmed!==1 || FINORA.Modal.stack.length){
300 + throw Error('A cancelled confirmation was executed by a stale button');
301 + }
302 + FINORA.Modal.confirm({title:'Q01 hidden parent confirmation',
303 + message:'Must remain inert while nested',onConfirm:()=>{syntheticConfirmed++;}});
304 + await wait(25);
305 + const hiddenParent=FINORA.Modal.stack[FINORA.Modal.stack.length-1]?.card;
306 + FINORA.Modal.confirm({title:'Q01 active child confirmation',
307 + message:'Cancel first',onConfirm:()=>{syntheticConfirmed++;}});
308 + await wait(25);
309 + hiddenParent?.querySelector('[data-action="confirm"]')?.click();
310 + if(syntheticConfirmed!==1 || FINORA.Modal.stack.length!==2){
311 + throw Error('Hidden parent confirmation changed ledger decision while child was active');
312 + }
313 + FINORA.Modal.stack[1].card.querySelector('[data-action="cancel"]').click();
314 + hiddenParent.querySelector('[data-action="cancel"]').click();
315 + if(FINORA.Modal.stack.length!==0 || syntheticConfirmed!==1){
316 + throw Error('Nested financial confirmations were not safely cancelled');
317 + }
318 // A confirmation message can contain user-provided contact names. It must
319 // never be interpreted as HTML or create a DOM node with event handlers.
320 const hostileMessage='<img src=x onerror="window.Q01_INJECTED=true">';
@@ -496,7 +524,8 @@
524 escapeClosesWithoutConfirm:true,focusReturnsToTrigger:true,
525 enterOnFocusedCancelDoesNotSave:true,enterOnInputDoesNotSubmit:true,
526 tabAndShiftTabStayInsideTopDialog:true,
499 - cancelDoesNotConfirmAndRestoresFocus:true,syntheticConfirmRunsExactlyOnce:true};
527 + cancelDoesNotConfirmAndRestoresFocus:true,syntheticConfirmRunsExactlyOnce:true,
528 + staleFinancialConfirmIgnored:true};
529 // Notification flood: transient success/info messages should never
530 // cover the dashboard. Important errors remain until explicitly dismissed.
531 for(let n=0;n<9;n++) FINORA.Toast.info('Q01 synthetic notice '+n);