Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-24650

Dashboard content parsing modifies rendering context

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Major
    • None
    • 16.10.0
    • Dashboard
    • 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:

      1. Log in as user with script (can also be admin or programming) right.
      2. Create a document with a dashboard macro nested inside a content macro:
        {{content syntax="xwiki/2.0"}}
        {{dashboard/}}
        {{/content}}
        
      3. 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.

      Attachments

        Activity

          People

            MichaelHamann Michael Hamann
            MichaelHamann Michael Hamann
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: