Opened 7 years ago

Closed 7 years ago

#8456 closed Bug (invalid)

blinking cursor causes null pointer

Reported by: Henrik Helmø Larsen Owned by:
Priority: Normal Milestone:
Component: General Version:
Keywords: Cc:

Description

I have received some errors from the wysiwygarea plugin.js line 1182 in CKEditor version 3.6.2. It is were editor.document.$.designMode is set to 'off'.

At this place the at setTimeout function has been called with a delay of 50 ms. The problem is that editor.document in the meantime has been set to null.

So the following code from the plugin fails:

editor.document.$.designMode = 'on';
setTimeout( function()
{
  editor.document.$.designMode = 'off';
  if ( CKEDITOR.currentInstance == editor )
    editor.document.getBody().focus();
}, 50 );

My suggestion is to insert a check for editor.document inside the setTimeout function:

editor.document.$.designMode = 'on';
setTimeout( function()
{
  if ( editor.document )
  {
    editor.document.$.designMode = 'off';
    if ( CKEDITOR.currentInstance == editor )
      editor.document.getBody().focus();
  }
}, 50 );

Change History (8)

comment:1 Changed 7 years ago by Jakub Ś

Status: newpending

I have received some errors from the wysiwygarea plugin.js line 1182 in CKEditor version 3.6.2.

To be honest this doesn't bring much information.

Would you be so kind and provide us with reduced Test Case showing the problem (sample HTML page, your custom plugin code that is causing this etc.).

comment:2 Changed 7 years ago by Henrik Helmø Larsen

I know that it doesn't provide much information. Sorry for that. But the problem is that it only occurs occasionally - or quite seldom. My idea for bringing the case up was that (I think) it is obvious that an error can occur in this place since you use a setTimeout(...) function and then not testing the environment when executing the delayed code. Anything can happen in the 50 ms it waits before beeing executed.

The check I suggest will only make the CKEditor more secure.

In my case (if you click fast enough) the editor.document is null'ed thus resulting in a nullPointerException...

comment:3 Changed 7 years ago by Jakub Ś

Although the proposed fix doesn’t look harmful it can improve one thing and break the other. What is more some errors occur simply because user had make mistake in his custom code or CKEditor configuration. That is why we usually ask for a reduced TC showing the bug “in code”. This gives us better understanding of the issue.

Perhaps it would be possible for you to come up with a piece of code that allows to reproduce the problem on regular basis?

Waiting for your feedback.

comment:4 Changed 7 years ago by Jakub Ś

@Helmø2 is there a chance for a reproducible TC?

comment:5 Changed 7 years ago by Jakub Ś

Version: 3.6.2

comment:6 Changed 7 years ago by Henrik Helmø Larsen

Sorry - I have been on vacation the last 7 days. I will try to make a version for you

comment:7 Changed 7 years ago by Henrik Helmø Larsen

I have now for the last 4 hours tried to re-create the problem and I can't :-( I guess you have to reclose the ticket. I have removed the extra check from my code - but the error doesn't seem to emerge... If I register it again I will post back here.

comment:8 Changed 7 years ago by Jakub Ś

Resolution: invalid
Status: pendingclosed

Thank you for the feedback.

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