Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 3.1
-
Fix Version/s: 4.3-milestone-1
-
Component/s: Skin Extensions
-
Labels:
-
Difficulty:Unknown
-
Documentation:N/A
-
Documentation in Release Notes:N/A
-
Similar issues:
XWIKI-4686Include macro sometimes fails when document parameter doesn't include the full name. XWIKI-3521Include Macro uses same revision number for included page as the current page XWIKI-6206Double wiki name prefix in group members listings XWIKI-5997Can't view/download attached files of included document using Include Macro XWIKI-7685 Improve Homepage editing and Dashboard 'included' message XWIKI-8829getVirtualWikisDatabaseNames does not include the main wiki when it has no descriptor XWIKI-3309Include Macro should set doc/space/wiki in the Execution Context when the include is done with a new context XWIKI-5020syntax2.0 include macro has trouble when context=new and included document is syntax1.0 with velocity code. XWIKI-1646Copy document with included content XWIKI-7177Include main wiki descriptor (XWiki.XWikiServerXwiki) into the Wiki Manager Application by default
Description
I had this issue on a multiwiki environment but I reproduced it in a single wiki environment as well. To reproduce:
1/ create a jsx extension with include="always on this wiki", say MySpace.MyJSX
2/ create a page in the wiki where you use the extension manually with
$xwiki.jsx.use('wikiname:MySpace.MyJSX')
When visualizing the page (and page source), you'll see that the element
<script type='text/javascript' src='/xwiki/wiki/wikiname/jsx/MySpace/MyJSX' defer='defer'></script>
actually appears twice.
This is caused because the deduplication on the ssx plugin side is done based on document fullname and while for the always used extensions this is MySpace.MyJSX, the manual one was containing a wiki name as well.
Also note that if the full prefixed document reference is invalid (points to an inexistent wiki) – for example in single wiki mode – the manual include still works, generating a correct link to the current wiki, and the deduplication still doesn't work.
Deduplication could also be done based on resources urls rather than names.
Note that there might be some special issues with this when the jsx registers a listener (at least on FF 3.6.28 ).
I discovered this while investigating the fact that the "save and continue" ajax was not executing. It was caused by the fact that there was a listener in the duplicated jsx, which, if executed twice, was putting the list of listeners in a bizarre state and caused the event to fail before reaching the save and continue listener.