Skip to content
This repository has been archived by the owner on Oct 26, 2022. It is now read-only.

Prism Breaks Jira Server When Browsing Issue Filter Results #19

Closed
libantema opened this issue Apr 17, 2019 · 4 comments · Fixed by #24
Closed

Prism Breaks Jira Server When Browsing Issue Filter Results #19

libantema opened this issue Apr 17, 2019 · 4 comments · Fixed by #24
Labels

Comments

@libantema
Copy link

libantema commented Apr 17, 2019

When I browse tickets with a Jira issue filter where the first ticket in the list of results contains a {code} block, the content of the page below the search form is grayed out and I can't click on anything. Disabling the Prism app resolves this issue, confirming that Prism is the culprit.

Jira Version: Server v8.0.2
Prism Version: v1.2.4
How to reproduce: Navigate to URL - for example: <base_jira_url>/browse/<ticket_with_a_code_block>?filter=-1
Current workaround: Navigate to the ticket without the filter - for example: <base_jira_url>/browse/<ticket_with_a_code_block>

If I inspect the page, I see the following JavaScript error in the console (line numbers are probably unique to my instance).

Uncaught RangeError: Invalid array length
    at batch.js:6731
    at Object.run (batch.js:6731)
    at Object.highlightElement (batch.js:6731)
    at Object.highlightAllUnder (batch.js:6731)
    at Object.highlightAll (batch.js:6731)
    at HTMLDocument.<anonymous> (batch.js:6734)
    at HTMLDocument.dispatch (batch.js:65)
    at HTMLDocument.v.handle (batch.js:65)
    at Object.trigger (batch.js:65)
    at Object.c.event.trigger (batch.js:85)

I navigated to the JS file and set some breakpoints to try to figure out what was going on. I also referenced the prism.js file.
What I discovered is that env.vars['command-line'] (see lines 9231-9232) is an empty object {}.
This then breaks the array instantiation on line 9250.
var promptLines = new Array(commandLine.numberOfLines + 1);
Some logic for checking the commandLine object before using it will probably fix this issue (and potentially others that haven't been discovered yet).

@libantema
Copy link
Author

I created an upstream PrismJS pull request as a potential fix for this issue. However, the fix will need to be tested for the Prism Jira app.

@siavashs
Copy link
Owner

Nice work @libantema
We have 2 options:

  • wait for your PR to be merged in upstream and release a new app version when a new PrismJS version is out
  • patch our copy of PrismJS

@siavashs siavashs added the bug label Apr 27, 2019
@libantema
Copy link
Author

@siavashs my upstream PR has been merged and Prism 1.16.0 has been built/released. You should be good to update the core PrismJS and test the new Jira app.

siavashs added a commit that referenced this issue Jun 23, 2019
This brings lots of bugfixes and improvements.
Should fix #19

[PrismJS 1.16.0 release](https://github.com/PrismJS/prism/releases/tag/v1.16.0)
@siavashs
Copy link
Owner

@libantema I opened #24 for this update, I hope this will fix the issue.

siavashs added a commit that referenced this issue Jun 24, 2019
This brings lots of bugfixes and improvements.
Should fix #19

[PrismJS 1.16.0 release](https://github.com/PrismJS/prism/releases/tag/v1.16.0)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants