job-dsl-plugin icon indicating copy to clipboard operation
job-dsl-plugin copied to clipboard

[JENKINS-71515] Make `codemirror-config` a valid JSON

Open yaroslavafenkin opened this issue 1 year ago • 0 comments

Needed before https://github.com/jenkinsci/jenkins/pull/6867 can get merged.

codemirror-config attribute is expected to be a valid JSON except the start and end bracket as per https://github.com/jenkinsci/jenkins/blob/cd3b1517e7a553fd6fcf39e25c4bd1e18fbe39de/core/src/main/resources/lib/form/textarea.jelly#L70-L73.

In the upstream change JSON#parse is used instead of eval to transform the codemirror-config into a JSON object. JSON#parse cannot parse function attributes, hence the drop of onBlur handler in this PR. There seems to be no need for it because this code re-adds it.

Testing done

Tested interactively against https://github.com/jenkinsci/jenkins/pull/6867. Created a freestyle job, added the Process Job DSLs build step. Made sure codemirror-config is parsed correctly, and no errors are thrown in the developer console.

### Submitter checklist
- [ ] Make sure you are opening from a **topic/feature/bugfix branch** (right side) and not your main branch!
- [ ] Ensure that the pull request title represents the desired changelog entry
- [ ] Please describe what you did
- [ ] Link to relevant issues in GitHub or Jira
- [ ] Link to relevant pull requests, esp. upstream and downstream changes
- [ ] Ensure you have provided tests - that demonstrates feature works or fixes the issue

yaroslavafenkin avatar Aug 16 '23 13:08 yaroslavafenkin