Uploaded image for project: 'Confluence Data Center'
  1. Confluence Data Center
  2. CONFSERVER-83216

Code Macro overrides RegEx object causing dependent JavaScript to break

XMLWordPrintable

      Issue Summary

      This is reproducible on Data Center: yes

      This affects all version of Confluence.

      When a user adds the code macro to a page in Confluence DC page, it imports the JavaScript in shCore.js, which overloads the

      • RegExp.prototype.apply
      • RegExp.prototype.call
      • RegExp.prototype.exec
      • RegExp.prototype.test
      • String.prototype.match
      • String.prototype.replace
      • String.prototype.split

      functions (at a minimum). This causes issues with any other code that uses these functions as they are not equivalent to the default functions.

      This is specific to the confluence-newcode-macro-plugin.

      Steps to Reproduce

      1. Create a page in Confluence Server DC
      2. Add a code macro, this will bring in the minified JavaScript from shCore.js
      3. Add another macro that has a dependency on one of the overloaded functions

      Expected Results

      The page loads without issue.

      Actual Results

      The page may become unresponsive, or the second macro fails to run.

      Workaround

      Remove the code macro from pages that have other macros that rely on correct functioning of RegExp

              Unassigned Unassigned
              jrichards@atlassian.com James Richards
              Votes:
              25 Vote for this issue
              Watchers:
              18 Start watching this issue

                Created:
                Updated: