Details
-
Bug
-
Resolution: Unresolved
-
Major
-
None
-
16.10.0
-
None
-
Unknown
-
Description
The gadget renderer executes the gadget content using a ContentExecutor<MacroTransformationContext> which isn't used anywhere else and appears to be duplicating today's MacroContentParser which evolved since the introduction of the content executor. One noticeable difference is that it doesn't use a fresh rendering context which has the following noticeable effect:
Steps to reproduce:
- Log in as user with script (can also be admin or programming) right.
- Create a document with a dashboard macro nested inside a content macro:
{{content syntax="xwiki/2.0"}} {{dashboard/}} {{/content}} - Edit the document in "inline form" mode add two gadgets (e.g., of type box) and set the title of each gadget to $xwiki.getCurrentContentSyntaxId()
Expected result:
Both gadgets display xwiki/2.0.
Actual result:
The first gadget displays xwiki/2.0 while the second displays xwiki/2.1.
What happens in the background is that the execution of the first gadget's content clears the current macro block of the rendering context (as it doesn't use a fresh one) and $xwiki.getCurrentContentSyntaxId() then falls back to the current document's syntax.
I'm not sure this has any real consequences but it is an inconsistency that could have further consequences when the code further diverges or more code relies on the rendering context being pushed.