There is 1 update, 1 comment.
 
 
XWiki Platform / cid:jira-generated-image-avatar-d1d31725-5451-42d0-b847-6f8483f56bd6 XWIKI-6688 Reopened

Possible race condition when clicking on a tab at the bottom of a page in view mode

 
View issue   ยท   Add comment
 

1 update

 
cid:jira-generated-image-avatar-7d1e378d-5420-44cc-9556-b3a4bc6f49a2 Changes by Vincent Massol on 17/Sep/26 20:27
 
Labels: bugfixingday
 
 

1 comment

 
cid:jira-generated-image-avatar-7d1e378d-5420-44cc-9556-b3a4bc6f49a2 Vincent Massol on 17/Sep/26 20:25
 
Reopening: the race condition still exists in the code. This issue was closed because the functional tests work around it, not because it was fixed.

The mechanism, in the current code:
* {{flamingo/docextra.vm}} registers, on {{dom:loaded}}, an {{extraInit}} function that calls {{XWiki.displayDocExtra()}} for the *first* tab (usually Comments).
* {{XWiki.displayDocExtra()}} (in {{xwiki.js}}) loads a tab with an {{Ajax.Request}} whose {{onComplete}} unconditionally calls {{dhtmlSwitch(extraID)}}. There is no request counter and no cancellation of an obsolete request.
* So when a second tab is opened while that initial load is still in flight, the two responses race and *the last one to arrive wins the active tab*
\u2014 - exactly the scenario described in this issue. The counter-based fix suggested by Sergiu in the description was never implemented.

Note that {{ViewPage.openDocExtraPane()}} waiting for the target pane to become visible does not close the race: the wait returns as soon as (for instance) {{Historypane}} becomes visible, and a Comments response landing a few milliseconds later hides it again.

The window is small in practice (the initial request is issued at {{DOMContentLoaded}} while Selenium can only click after the load event has fired), which is why we do not see flickers any more. But the bug is still there, and some tests still carry explicit workarounds referencing this issue: {{VersionIT}}, {{CopyPageIT}} and {{PageTemplatesIT}}.

Fixing it properly in {{xwiki.js}} (ignore the response of a tab load that is no longer the last requested one) allows dropping those workarounds.