Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix customConfig race condition #4173

Merged
merged 6 commits into from
Jul 27, 2020
Merged

Fix customConfig race condition #4173

merged 6 commits into from
Jul 27, 2020

Conversation

jacekbogdanski
Copy link
Member

What is the purpose of this pull request?

Bug fix

Does your PR contain necessary tests?

All patches that change the editor code must include tests. You can always read more
on PR testing,
how to set the testing environment and
how to create tests
in the official CKEditor documentation.

This PR contains

  • Unit tests
  • Manual tests

Did you follow the CKEditor 4 code style guide?

Your code should follow the guidelines from the CKEditor 4 code style guide which helps keep the entire codebase consistent.

  • PR is consistent with the code style guide

What is the proposed changelog entry for this pull request?

* [#3361](https://github.com/ckeditor/ckeditor4/issues/3361): Fixed: Loading multiple [custom editor configurations](https://ckeditor.com/docs/ckeditor4/latest/api/CKEDITOR_config.html#cfg-customConfig) is prone to race condition between them.

What changes did you make?

Honestly, I was really wondering about rewriting the whole customConfig loading as it could be nicely simplified and the current implementation is pretty bloated. Although, it's not a very good idea to do with a core code 10 years old. I propose simple fix instead, making sure that we won't overwrite cached config functor by a closure race condition.

Which issues does your PR resolve?

Closes #3361.

@Dumluregn Dumluregn self-requested a review July 24, 2020 10:15
@Dumluregn Dumluregn self-assigned this Jul 24, 2020
Copy link
Contributor

@Dumluregn Dumluregn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, very simple and clear fix 👍 Unit and manual tests pass on all browsers too. I only proposed a few minor amendments.

tests/core/editor/custom_config_race.js Outdated Show resolved Hide resolved
tests/core/editor/custom_config_race.js Outdated Show resolved Hide resolved
tests/core/editor/custom_config_race.js Outdated Show resolved Hide resolved
tests/core/editor/custom_config_race.js Outdated Show resolved Hide resolved
tests/core/editor/manual/customconfigrace.html Outdated Show resolved Hide resolved
tests/core/editor/manual/customconfigrace.md Outdated Show resolved Hide resolved
tests/core/editor/manual/customconfigrace.md Outdated Show resolved Hide resolved
core/editor.js Show resolved Hide resolved
@Dumluregn Dumluregn self-assigned this Jul 27, 2020
Copy link
Contributor

@Dumluregn Dumluregn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants