Opened 6 years ago

Closed 4 years ago

#10030 closed Bug (fixed)

IE8 "Unspecified Error ckeditor.js, line 63 character 296" on CKEditor 4 load

Reported by: Tony Payne Owned by: Artur Delura
Priority: Normal Milestone: CKEditor 4.4.4
Component: General Version:
Keywords: CantFix IE8 IE9 Support Cc:

Description

I updated from CKEditor 3 to 4, updated the custom config, plugins etc, and everything seems to work ok, except that sometimes when the editor instance loads I get this error "Unspecified Error ckeditor.js, line 63 character 296". The section of ckeditor.js on line 63 that is highlighted by IE8 debugger is:

return new CKEDITOR.dom.element(this.$.activeElement)

This is sporadic, doesn't happen every time, and never used to happen with CKEditor3. I can load a page and editor content loads correctly, save the content, reload the page, and then I get the error, even though the content to include in the textarea has not changed (it's stored in an SQL table).

As far as I am aware this is only happening in IE8 (I am running XP Pro with SP3). I can't replicate on FF or Chrome.

Attached is:

(a) The code on the page that activates the editor

(b) The editor content that is being loaded

(c) The custom config.

Attachments (4)

aCode_Extract.txt (503 bytes) - added by Tony Payne 6 years ago.
bText_To_Load.txt (662 bytes) - added by Tony Payne 6 years ago.
config_draper1.txt (4.8 KB) - added by Tony Payne 6 years ago.
iframe.html (658 bytes) - added by Jakub Ś 5 years ago.

Download all attachments as: .zip

Change History (40)

Changed 6 years ago by Tony Payne

Attachment: aCode_Extract.txt added

Changed 6 years ago by Tony Payne

Attachment: bText_To_Load.txt added

Changed 6 years ago by Tony Payne

Attachment: config_draper1.txt added

comment:1 Changed 6 years ago by Jakub Ś

Keywords: IE unspecified error removed
Status: newpending
Version: 4.0.1

save the content, reload the page, and then I get the error

CKEditor has nothing to do with data submit. Is it possible to replicate this in ajax.html sample? The one that acts like submit but without actual submit. This could help us determine if there is problem in editor or in your application only.

I have noticed that you use plugins like: iespell confighelper. These are not default plugins. Could you check if you get errors without them?

Error in ckeditor.js doesn't tell too much. Could you please download git version or source version from builder - http://ckeditor.com/builder, make checked and then see where error occurs. This should show exact plugin, path and message.

Please check all the above and leave a reply.

comment:2 Changed 6 years ago by Tony Payne

I am performing tests as requested, but maybe should also clarify how CKEditor is implemented in this situation.

An instance of CKEditor exists on a PHP generated page, using the code extract that is in the previously attached file.

The page is loaded by clicking on a link on a previous page, the editor content being retrieved from an SQL table.

When the editing is complete, a button on the page executes a Javascript function which retrieves the editor content, uses a PHP script to save this to the same SQL table.

The first time that the page containing the editor is loaded there is no problem. However, in IE8 when the data has been saved, the display returned to the previous page, and the user clicks the link to edit the text again, the editor generates this error on loading.

Sorry this is the best that I can explain it, but I hope it helps. It certainly only seems to do this in IE8, which is frustrating because if I could get it to do it in FF I could maybe find out the cause myself using Firebug.

Will update with results of test as soon as I can.

If nothing is conclusive from my tests, would it help to provide access to the programs?

comment:3 Changed 6 years ago by Tony Payne

Results below (script tags changed from < to [).

Test 1.

I used the ajax.html sample, but this seemed to work ok, no matter what I tried I was unable to break it.

Test 2.

I downloaded the full source package from builder and used this without any customisation.

CKEDITOR is loaded within a table on my page using the following code:

<tr>
 <td align="left" class="cell">
  <textarea id="textfield1" name="textfield1"><?php echo $testResults;?></textarea>
  [script type="text/javascript"
	CKEDITOR.replace( 'textfield1' );
  [/script>
 </td>
</tr>

The first time that the page is loaded, all is well, as before.

However, when I click a button to revert to the calling page, and then click on the link to load this page again, I DO get an error.

Using the optimized version of CKEditor I got exactly the same error as before:

unspecified error ckeditor.js, line 63 character 296

Using the source version of CKEditor I get a different error:

unspecified error document.js, line 126 character 3

The code that is failing is:

  getActive: function() {
  return new CKEDITOR.dom.element( this.$.activeElement );  <-- line 126
  },

Since this is IE8 I tried running in Compatibility mode also, but it made no difference.

Hopefully this will help in determining the cause of the problem.

comment:4 Changed 6 years ago by Jakub Ś

We are getting closer. If this is only happening in your application then I should close this issue but because of test two I think we should dig deeper.

I click a button to revert to the calling page, and then click on the link to load this page again, I DO get an error.

What does it mean button to revert page? Is there any change you could perhaps prepare reduced test case file showing this part? Perhaps there is a simple way to reproduce this and there is a bug in editor?

comment:5 Changed 6 years ago by Fakerhardcore

I got the same error on IE9 after upgrade from CK3 to CK4. "Unspecified Error ckeditor.js, line 63 character 296"

The editor is shown but the initial value is empty. This only happens when i run Ckeditor in frame, when i load the frame with the editor alone the initial value is ok.

comment:6 in reply to:  5 Changed 6 years ago by Tony Payne

Replying to Fakerhardcore:

I got the same error on IE9 after upgrade from CK3 to CK4. "Unspecified Error ckeditor.js, line 63 character 296"

The editor is shown but the initial value is empty. This only happens when i run Ckeditor in frame, when i load the frame with the editor alone the initial value is ok.

I guess that's good - it's not just unique to my setup. My application is running in a frame as well, so this could be a clue.

Last edited 6 years ago by Tony Payne (previous) (diff)

comment:7 in reply to:  4 Changed 6 years ago by Tony Payne

Replying to j.swiderski:

I click a button to revert to the calling page, and then click on the link to load this page again, I DO get an error.

What does it mean button to revert page? Is there any change you could perhaps prepare reduced test case file showing this part? Perhaps there is a simple way to reproduce this and there is a bug in editor?

There is a button that causes the entered content of the page to be saved and that calls a PHP script to redisplay the page that the user was on prior (Display Report Page). A Link on the Display Report Page executes a PHP script to load the Edit Report Page, which contains the Editor.

If you wish I can create a login for our test system so you can see more clearly what I am trying to explain. If so, how can I securely send the link/details?

comment:8 Changed 5 years ago by Chiron Heremans

This is a jQuery problem and not a CKeditor bug.

Having read about this issue on jQuery, I have found a temporary workaround to this problem: http://bugs.jquery.com/ticket/13378 & http://bugs.jqueryui.com/ticket/8443

I have edited the ckeditor.js file and changed the getActive function from

getActive:function(){return new CKEDITOR.dom.element(this.$.activeElement)}

to

getActive:function(){try{return new CKEDITOR.dom.element(this.$.activeElement) } catch( e ) { return new CKEDITOR.dom.element(this.$.body) }}

This solved my issue.

comment:9 Changed 5 years ago by Jakub Ś

Keywords: CantFix added
Status: pendingconfirmed

@azkme thank you for the bug reports.

I'm confirming and marking this ticket as 'Can't fix' however I'm not sure about that last part as @azkme has shown that certain workaround can be applied in editor.

comment:10 Changed 5 years ago by Roy Shoa

Hi, I am having the same bug in IE9. I just do not understand why the ticket is "Can't fix"? The fix that "j.swiderski" made is fixing it and i think it will be batter if it will fix in the next CKEditor version. Thanks.

comment:11 Changed 5 years ago by Jakub Ś

@royshoa I haven't provided any fix. User @azkme did.

I have marked this issue with Can't fix due to what @azkme has written: "This is a jQuery problem and not a CKEditor bug."

The main problem is that users provided explanations like - saving and jQuery. These are areas that have nothing to do with CKEditor. Are you able to provide sample page that shows this problem in editor? I talking about page that doesn't use any logic of your application, just editor (and jQuery if necessary).

If you can't provide such TC could you at least provide detailed description of situation in which you are getting this problem? Are you using jQuery in your project as well? @poddys and @ Fakerhardcore were you using jQuery in your project as well? If everyone is using jQuery and these bugs in jQuery are marked as won’t fix then perhaps we could have it fixed in CKEditor but first we need to have one consistent scenario in which this problem occurs.

comment:12 Changed 5 years ago by Tony Payne

@ j.swiderski The project that my problem occurs on doesn't use JQuery.

comment:13 Changed 5 years ago by Jakub Ś

@poddys maybe we have the same bug as jQuery. I will wait for others to answer and forward this request to my colleague.

comment:14 Changed 5 years ago by Roy Shoa

Hi, In my case i am not using jQuery but i am using ExtJs. The JavaScript error accrue when I am refreshing the page that use the CKEditor on a hidden layout. In my case, I have a ExtJs layout that including a iframe with the CKEditor object. When the user clicking on the Save button I am sending the form and hide the Ext Layout. Now, In the background I am reloading the iframe with the CKEditor object so the next time the user will like to edit the page will be loaded and the user will not need to wait. When the page is loading I am getting the error.

I think that it is because the CKEditor trying to focus itself when the layout is hidden or something like this.

I do not success to produce the same bug in a new page with a hidden iframe.

I hope that this information is helpful.

comment:15 Changed 5 years ago by Jakub Ś

@royshoa, @poddys I have been trying to prepare reproducible test case for this issue but no luck so far. Is there any chance you could provide reduced (as small as possible) and working sample page/application that shows this problem?

You could either attach it here or send it to j.swiderski@…

comment:16 Changed 5 years ago by Tony Payne

Although I am monitoring this ticket, I have been dragged onto another project for now, so it's going to be a couple of months before I have time to work on updating our implemtation to use the latest version of CKEditor.

I unfortunately don't have time to prepare a test example, but the login to our test site I sent before should still be valid (if not I can re-activate it), and I am hoping this fault/anomaly can be fixed (or a workaround found).

comment:17 in reply to:  15 Changed 5 years ago by Roy Shoa

Replying to j.swiderski: Hi, I do not have time to make a example of this bug but I have information that may help you. Its happen only when the editor is in focus and you try to submit the editor form from another window.

e.g. You need to have a iframe with CKEditor instance in the iframe and a button that positioned in the parent window and when clicking on the button you need to make submit to the form in the iframe with the CKEdtior (you need to click submit only when you are focusing the CKEdtitor).

In this case when you click on the button outside the iframe the CKEditor is still in focus and the form is submitted.

This is when the error need to be accrue with IE9 browser.

I fix it for now by focusing the body tag in the iframe before sending the form, in this way the editor stop from been in focus and the error is no accrue.

Last edited 5 years ago by Roy Shoa (previous) (diff)

comment:18 Changed 5 years ago by Tony Payne

That sounds exactly like our situation, with a top iframe that has buttons, and the editor loaded in a 2nd iframe that is in focus. The action button is in the top frame and Javascript is used to prepare and submit the form that is in the 2nd frame.

In our case the problem arises with IE8, I have not been able to try it with IE9/10 yet.

Replacing the iframes in the system would require a major redesign.

comment:19 Changed 5 years ago by Robert

I also get the issue, it was a textarea in an iframe that I was using

I could only replicate the issue on Windows 7 32 bit running IE9

All the following combinations worked fine windows 7 32 bit IE10 windows 7 64 bit IE9 windows 7 64 bit IE10 windows 8 64 bit IE9 windows 8 64 bit IE10 windows xp IE8

The fix posted by azkme worked fine

comment:20 Changed 5 years ago by Jakub Ś

So far you have mentioned: jQuery, Saving, iframe, focus on editor IE8 and IE9.

Lots of you have mentioned lately saving when editor is in iframe. Based on your descriptions I have prepared iframe.html file that can be put in editor samples folder and will call editor from replacebyclass.html.

I have tried this file in IE8 and IE9 but no error has occurred. I have loaded page, focused editor (even did some typing/changes etc.) and finally I have pressed the button. In my case no error occurred.

Could anyone of you tell me what have I missed?
Can anyone prepare similar HTML file that will cause error in standalone editor freshly downloaded from our page?

Changed 5 years ago by Jakub Ś

Attachment: iframe.html added

comment:21 Changed 5 years ago by Jakub Ś

Keywords: Support added

I will also forward this issue because maybe what is written in http://bugs.jquery.com/ticket/13378#comment:13 and comment:8 is enough to provide a fix.

Edit:
Perhaps this will also help - http://tjvantoll.com/2013/08/30/bugs-with-document-activeelement-in-internet-explorer/

Last edited 5 years ago by Jakub Ś (previous) (diff)

comment:22 Changed 5 years ago by Piotrek Koszuliński

Keywords: IE9 added
Status: confirmedpending

I also tried to reproduce this issue. I checked many scenarios - hidden iframe, dynamically created iframe, different kind of buttons/links that have to be clicked to trigger form submit - no luck.

Without a reproducible scenario we are not able to work on this issue. I'm resetting status to 'pending'.

comment:23 Changed 4 years ago by Stephen E. Baker

I am also getting this error on one of our pages in IE8 and IE9, using the latest CKEditor 4.4.2

Strangely I have other pages in the same application using the same ckeditor config which do not experience the error. I am not able to discern any difference between the pages that work and the pages that don't. For instance:

Both pages are in iframes (the same iframe actually) I don't use any javascript framework, though I do alias $ to document.getElementById using the same script for both places. Both pages use the same name and id for the textarea.

One page was using cols and rows and the other was using width and height, but I changed them to match with no change in behaviour.

What I am able to see in the debugger is that the Unspecified error comes from accessing this.$.activeElement (I see the same thing in the watch for that property). Other properties of this.$ work, e.g. alinkColor is "#0000ff".

Edit: The watch lists: activeElement Unspecified error. IHTMLElement So it knows it should be an IHTMLElement.

Last edited 4 years ago by Stephen E. Baker (previous) (diff)

comment:24 Changed 4 years ago by Stephen E. Baker

As a follow up, based on my research into Unspecified Error and what I'm seeing with the debugger enabled, I believe you are accessing an element which has been removed from the DOM. At the point the error occurs the old textarea has been removed and the new ckeditor hasn't been added yet.

comment:25 Changed 4 years ago by Stephen E. Baker

For debugging I was trying removing elements from the affected page slowly. I found removing an unrelated iframe prevented the error from occurring.

I added the iframe back in and changed the src to about:blank. This also didn't trigger the error. I changed the source to another cfm page, and the error returned. I changed the source to a completely blank cfm page and the error didn't fire. I added the trivial html boilerplate to the cfm and the error still didn't come up. However when I added a 100ms sleep to the cfm the error happened again.

I believe something about the document ready/loaded event from the iframe is triggering this error.

comment:26 Changed 4 years ago by Stephen E. Baker

As for a workaround, moving CKEDITOR.replace to a document.onload event works.

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

Milestone: CKEditor 4.4.3
Status: pendingconfirmed

Thanks for an in-depth analysis. I think that it's clear now that the unspecified error is a result of some incorrect state in IE's internals and it's sensitive to timing. IE doesn't know what to do so it throws an error :D.

Another thing that it's clear now is that there are many different scenarios. Page loading, submitting data, etc. This means that we would have to analyse them one by one in order to fix them properly (with the lowest possible influence on unrelated code usage). And since this error is so fragile that would be crazy. Thus, let's add try-catch inside getActive(). Accessing this property should never cause an error, so if an error is thrown by IE we can be sure that IE is already in an incorrect state.

Thing to check - what happens if getActive() returns null. That case may not be handled because other code may expect that there's always an active element. In such case we need to update all getActive() usage places too.

I'm confirming this issue based on feedback. We've never reproduced it on our side.

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

Milestone: CKEditor 4.4.3CKEditor 4.4.4

The 4.4.3 milestone was shortened, so the remaining tickets must be postponed.

comment:29 Changed 4 years ago by Artur Delura

Owner: set to Artur Delura
Status: confirmedassigned

comment:30 Changed 4 years ago by Artur Delura

I've wrapped access to activeItem into try catch block, and when error is raised then null is returned. Also checked getActive method calls, and updated when necessary. Changes in branch:t/10030

comment:31 Changed 4 years ago by Artur Delura

Status: assignedreview

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

Status: reviewreview_failed

I pushed one commit to rebased branch:t/10030.


I think that there are still some places in which getActive()'s returned value is not verified. E.g.:

core/editable.js:				if ( this.equals( CKEDITOR.document.getActive() ) ) {
plugins/sourcearea/plugin.js:				var wasActive = needsFocusHack && this.equals( CKEDITOR.document.getActive() );
plugins/widget/plugin.js-	function onEditableBlur() {
plugins/widget/plugin.js:		var active = CKEDITOR.document.getActive(),
plugins/widget/plugin.js-			editor = this.editor,
plugins/widget/plugin.js-			editable = editor.editable();
plugins/widget/plugin.js-
plugins/widget/plugin.js-		// If focus stays within editor override blur and set currentActive because it should be
plugins/widget/plugin.js-		// automatically changed to editable on editable#focus but it is not fired.
plugins/widget/plugin.js-		if ( ( editable.isInline() ? editable : editor.document.getWindow().getFrame() ).equals( active ) )
plugins/widget/plugin.js-			editor.focusManager.focus( editable );
plugins/widget/plugin.js-	}

Note that at least now we don't have to check returned value on other than IE browsers.


We can remove this try-catch now:

core/selection.js-			// IE8,9 throw unspecified error when trying to access document.$.activeElement.
core/selection.js-			try {
core/selection.js:				active = this.document.getActive();
core/selection.js-			} catch ( e ) {}

Remember to verify that active is checked further.

comment:33 in reply to:  32 Changed 4 years ago by Artur Delura

Replying to Reinmar:

I pushed one commit to rebased branch:t/10030.


I think that there are still some places in which getActive()'s returned value is not verified. E.g.:

core/editable.js:				if ( this.equals( CKEDITOR.document.getActive() ) ) {

I didnt handle this because method equals handle this by self.

plugins/sourcearea/plugin.js:				var wasActive = needsFocusHack && this.equals( CKEDITOR.document.getActive() );

Same as above.

plugins/widget/plugin.js-	function onEditableBlur() {
plugins/widget/plugin.js:		var active = CKEDITOR.document.getActive(),
plugins/widget/plugin.js-			editor = this.editor,
plugins/widget/plugin.js-			editable = editor.editable();
plugins/widget/plugin.js-
plugins/widget/plugin.js-		// If focus stays within editor override blur and set currentActive because it should be
plugins/widget/plugin.js-		// automatically changed to editable on editable#focus but it is not fired.
plugins/widget/plugin.js-		if ( ( editable.isInline() ? editable : editor.document.getWindow().getFrame() ).equals( active ) )
plugins/widget/plugin.js-			editor.focusManager.focus( editable );
plugins/widget/plugin.js-	}

Same as above.

Note that at least now we don't have to check returned value on other than IE browsers.

So i there something to do with that? I think no.

Pushed changes to branch:t/10030

comment:34 Changed 4 years ago by Artur Delura

Status: review_failedreview

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

Status: reviewreview_passed

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

Resolution: fixed
Status: review_passedclosed

Fixed on master with git:8a6bb0d.

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