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

ReferenceError: Can't find variable: ES6Promise #3287

Closed
mflorea opened this issue Jul 20, 2019 · 3 comments · Fixed by #3360
Closed

ReferenceError: Can't find variable: ES6Promise #3287

mflorea opened this issue Jul 20, 2019 · 3 comments · Fixed by #3360
Assignees
Labels
core The issue is caused by the editor core code. status:confirmed An issue confirmed by the development team. target:major Any docs related issue that should be merged into a major branch. type:bug A bug.
Milestone

Comments

@mflorea
Copy link
Contributor

mflorea commented Jul 20, 2019

Type of report

Bug

Provide detailed reproduction steps (if any)

I'm running integration tests using PhantomJS (which doesn't implement Promise) and I'm using RequireJS (AMD) to load other modules besides CKEditor.

Expected result

The tests were passing before upgrading to from CKEditor 4.11.4 to CKEditor 4.12.1.

Actual result

The tests are failing now with:

ReferenceError: Can't find variable: ES6Promise

Other details

  • Browser: PhantomJS
  • OS: Ubuntu 19.4
  • CKEditor version: 4.12.1
  • Installed CKEditor plugins: standard set

Upon checking the code I believe the culprit is this 438a019#r34380433 .

The workaround for me was to run this before my tests:

window.Promise = window.Promise || function() {};

It works because CKEditor doesn't use the Promise that much at the moment (and so it doesn't affect my tests), but this may change in the future.

@mflorea mflorea added the type:bug A bug. label Jul 20, 2019
@jacekbogdanski jacekbogdanski self-assigned this Jul 23, 2019
@jacekbogdanski
Copy link
Member

I agree the test could be improved by stubbing Promise object instead of using globals.

@jacekbogdanski jacekbogdanski added status:confirmed An issue confirmed by the development team. type:task Any other issue (refactoring, typo fix, etc). and removed type:bug A bug. labels Jul 23, 2019
@jacekbogdanski jacekbogdanski removed their assignment Jul 23, 2019
@mflorea
Copy link
Contributor Author

mflorea commented Aug 9, 2019

Actually this issue affects IE11 and not just PhantomJS, for the same reasons, but this time at runtime and not during tests, which raises the severity of the issue IMO.

@f1ames
Copy link
Contributor

f1ames commented Aug 21, 2019

The workaround for me was to run this before my tests:

window.Promise = window.Promise || function() {};

It will work only if tests are not using promises, so it's a quick workaround, but not a proper solution.

Actually this issue affects IE11 and not just PhantomJS, for the same reasons, but this time at runtime and not during tests, which raises the severity of the issue IMO.

So basically, it is an issue for ever browser where polyfill is used and CKEditor loaded via RequireJS (or any other AMD loader)😭

@mflorea thanks for investigating this issue. I wonder if there is any reasonable way to detect that CKEditor was loaded via AMD and adjust the polyfill setup in 438a019#r34380433 🤔

@f1ames f1ames added this to the 4.13.0 milestone Aug 21, 2019
@f1ames f1ames added type:bug A bug. core The issue is caused by the editor core code. target:major Any docs related issue that should be merged into a major branch. and removed type:task Any other issue (refactoring, typo fix, etc). labels Aug 21, 2019
@Comandeer Comandeer self-assigned this Aug 27, 2019
mflorea added a commit to xwiki-attic/application-ckeditor that referenced this issue Oct 8, 2019
We shouldn't need this fix now that ckeditor/ckeditor4#3287 has been fixed and we're upgrading to CKEditor 4.13.0

This reverts commit 3f43d50.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core The issue is caused by the editor core code. status:confirmed An issue confirmed by the development team. target:major Any docs related issue that should be merged into a major branch. type:bug A bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants