ckeditor4 icon indicating copy to clipboard operation
ckeditor4 copied to clipboard

Occasional stack trace error: Cannot read property 'on' of undefined

Open CExJTian opened this issue 6 years ago • 4 comments

Hi there,

We are using ckeditor version 4.11.2 and noticed occasional stack trace in server log: TypeError: Cannot read property 'on' of undefined

It seems to be caused by following code in file ckeditor.js, line 351 - 352.

attachListener: function(a) {
    !this._.listeners && (this._.listeners = []);
    var b = Array.prototype.slice.call(arguments,
            1),
        b = a.on.apply(a, b);
    this._.listeners.push(b);
    return b
}

It would be great if it can be taken care of when a is undefined.

Thanks!

Type of report

Bug

Provide detailed reproduction steps (if any)

Expected result

No stack trace error

Actual result

TypeError: Cannot read property 'on' of undefined

Other details

  • Browser: Chrome
  • OS: Mac
  • CKEditor version: 4.11.2

CExJTian avatar Aug 20 '19 14:08 CExJTian

Hello, thanks for creating this issue, could you give us some more details like when this error occurs? And if it can be reproduced in the current version, i.e. 4.12.1?

Dumluregn avatar Aug 21 '19 08:08 Dumluregn

For me the bug appears in chrome when changing editor mode to source and setting new data with event.editor.setData

editor.on('beforeSetMode', function(event) {
            var commentData;
             if ( event.data == 'source' ) {
                commentData = smileyHandler(event.editor.getData(),true);
                event.editor.setData(commentData);
             } else {
                commentData = smileyHandler(event.editor.getData(),false);
                event.editor.setData(commentData);
             }
         });

You can go through link http://www.aiglemedia.com/php/ajaxguestbook/ to verify the problem. Just click on add entry button and you will get the editor instance.

Also i see network activity of loading contents.css when switching to WYSIWYG mode.

And yes it appears in version 4.12.1 also which i have right now tested on local machine.

aasiph avatar Aug 26 '19 15:08 aasiph

It seems that the issue is connected with the fact that initialisation of iframe-based editable, provided by wysiwygarea plugin, is asynchronous and part of it tries to finish after changing mode and destroying the iframe.

Comandeer avatar Aug 26 '19 19:08 Comandeer

I also encountered this problem. How can I solve it

GitLaser avatar Sep 30 '22 14:09 GitLaser