Opened 5 years ago

Closed 4 years ago

#12390 closed Bug (expired)

When an asynchronous post back happens really quickly after loading a CKEditor, a script error occurs

Reported by: infoland Owned by:
Priority: Normal Milestone:
Component: General Version: 4.4.4
Keywords: Cc:

Description

When an asynchronous post back happens immediately after loading a CKEditor, a script error occurs around this piece of code:

a.readOnly=!(!c.readOnly&&!(a.elementMode==CKEDITOR.ELEMENT_MODE_INLINE?a.element.is("textarea")?a.element.hasAttribute("disabled"):a.element.isReadOnly():a.elementMode== CKEDITOR.ELEMENT_MODE_REPLACE&&a.element.hasAttribute("disabled")

This is because a.element is <null>, but this is not checked before it is used.

Attachments (2)

CKEditorTest.zip (1.5 MB) - added by infoland 5 years ago.
Test ASP.Net project which recreates the problem
PrtScr capture_4.png (145.5 KB) - added by infoland 5 years ago.
Screen capture of the debugger where the error occurred

Download all attachments as: .zip

Change History (5)

Changed 5 years ago by infoland

Attachment: CKEditorTest.zip added

Test ASP.Net project which recreates the problem

Changed 5 years ago by infoland

Attachment: PrtScr capture_4.png added

Screen capture of the debugger where the error occurred

comment:1 Changed 4 years ago by dsu

I'm encountering a very similar error here:

CKEDITOR.plugins.add("save",{init:function(a){if(a.element!=null)a.elementMode==CKEDITOR.ELEMENT_MODE_REPLACE&&(a.addCommand("save",b).modes={wysiwyg:!!a.element.$.form}

a.element is null sometimes and not checked.

comment:2 Changed 4 years ago by Jakub Ś

Status: newpending

Hi,

I have checked your sample project and think it is happening due to some CKEditor related action being called too fast.
In you project I have seen page being reloaded vary fast 10 times or more in 200 milliseconds intervals. I haven’t seen any editor code (most likely it is inside DLL) but my guess is that whole this report is a duplicate of http://dev.ckeditor.com/ticket/11502#comment:8.

When page is being relaoded 5 times in one second it is possible that something may break. If this was only for test then in order to avoid such errors you can:

  1. use editor.status and editable.status
  2. use callbacks for setData if this error occurs when setting data - http://dev.ckeditor.com/ticket/10501#comment:10
  3. reload page after instanceReady or instanceDestroyd is fired, http://docs.ckeditor.com/#!/api/CKEDITOR-event-instanceDestroyed, http://docs.ckeditor.com/#!/api/CKEDITOR-event-instanceReady.

CKEditor is huge application and, as explained in ticket #11502, it may happen that in some cases some methods are not loaded yet but they are called. In such cases I think the best approach is not forcing actions on CKEditor but cooperating with it. IMHO your code could wait these extra few milliseconds and e.g. setData or destroy editor once it is loaded.

@infoland are these the issues you were getting?

comment:3 Changed 4 years ago by Piotrek Koszuliński

Resolution: expired
Status: pendingclosed
Note: See TracTickets for help on using tickets.
© 2003 – 2019 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy