Opened 6 years ago

Closed 4 years ago

#8578 closed Bug (expired)

this.getWindow().$.getComputedStyle(this.$, \"\") is null

Reported by: scott schmitz Owned by:
Priority: Normal Milestone:
Component: General Version:
Keywords: Firefox Cc:

Description

I an seeing the following error: this.getWindow().$.getComputedStyle(this.$, \"\") is null

userAgent:Mozilla/5.0 (Windows NT 6.1; WOW64; rv:8.0) Gecko/20100101 Firefox/8.0

The code in question is located at element.js line 502.

I am recommending that the code change from:

return this.getWindow().$.getComputedStyle( this.$, ).getPropertyValue( propertyName );

to

return this.getWindow().$.getComputedStyle( this.$, ) ? this.getWindow().$.getComputedStyle( this.$, ).getPropertyValue( propertyName ) : null;

that will fix the problem.

thanks,

Scott Schmitz.

Attachments (5)

getComputedStyle_null.png (34.5 KB) - added by Wiktor Walc 5 years ago.
hc_error.png (50.5 KB) - added by Wiktor Walc 5 years ago.
hc_error2.png (48.4 KB) - added by Wiktor Walc 5 years ago.
_mytest4.html (7.5 KB) - added by Jakub Ś 5 years ago.
_mytest3.html (7.5 KB) - added by Jakub Ś 5 years ago.

Download all attachments as: .zip

Change History (17)

comment:1 Changed 6 years ago by Jakub Ś

Status: newpending

Could you give us more information here?

First of all what scenario is causing this error? Could you provide a reduced sample HTML file showing the problem?

Second what version of CKEditor are you using?

Does your issue has something to do with bug #7856? Are you getting your bug in similar or the same scenario?

comment:2 Changed 6 years ago by scott schmitz

I have been unable to reproduce this problem under controlled conditions. However, with logging, I am able to see 2-3 of these errors per day happening to my users. Really wish I could put a try catch and catch these errors before they cause complete failure to our system - but oh well...

We have several thousand users and they are all using CKEditor. I have error logging, so every error that happens on any of those users computers is reported back to me. However, the information that is reported back is somewhat limited. I do know that this is specific to Firefox. Does not happen with IE and does not happen with Chrome.

I have spoken with several of my customers (who are not tech savvy) who have had these errors and the best I can determine is that this error is caused when people are copying / pasting or dragging & dropping Microsoft Word styled text into CKEditor. So, I believe it has something to do with the funky styling that MS Word documents have. Currently, I strip all styling from copy/paste as well as drag/drop in order to minimize the possibility of problems. However, this alone did not resolve the problem.

I am using CKEditor 3.6.2

I made the change that I have recommended several weeks ago and am no longer seeing these errors in my log. So, I believe this has resolved the problem. I was getting 2-3 of these errors a day and now I do not see any of these errors any more.

I am familiar with #7856 and I do not believe that this is the same bug. However, I can not say one way or the other on this. One thing that I can say is that the way I have CKEditor configured is that I do not display the context sensitive menu from CKEditor and instead have the one for Firefox display when people right click. I want to have the default spell checking in Firefox to work.

Scott Schmitz.

comment:3 Changed 6 years ago by Jakub Ś

Resolution: duplicate
Status: pendingclosed

This is a DUP of #7856

the one for Firefox display when people right click

@SSchmitz99 I think this is the key to understanding the bug. Thank you.

I have added a ciomment in #7856 about your findings.

comment:4 Changed 5 years ago by Wiktor Walc

Keywords: Firefox added
Resolution: duplicate
Status: closedreopened

I'm reopening the ticket as the bug has nothing to do with the context menu. This error is about improper assumption that getComputedStyle() never returns null.

This isn't true, because there is at least one case in FF where null is returned: https://bugzilla.mozilla.org/show_bug.cgi?id=548397

I just faced this issue when checking CKEditor 4 in Drupal 7. The error is happening when CKEditor loads (while HC detection). I'm attaching some screenshots. Imho the solution for this issue is plain simple as the reporter suggested, do not call getPropertyValue() on a null value.

Last edited 5 years ago by Wiktor Walc (previous) (diff)

Changed 5 years ago by Wiktor Walc

Attachment: getComputedStyle_null.png added

Changed 5 years ago by Wiktor Walc

Attachment: hc_error.png added

Changed 5 years ago by Wiktor Walc

Attachment: hc_error2.png added

comment:5 Changed 5 years ago by Wiktor Walc

#9288 was marked as duplicate. #9288 Contains some detailed information about the issue as well as a link to a video.

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

Proposed patch is incorret. It bypasses the problem and may lead to bigger problems.

Current situation:

  • FF returns null.
  • There's an error which stops execution of some code.
  • Everything seems to work (is this right? UPDATE: I see in #9288 that not, but at least it's not so bad ;)).

After we'll apply that patch:

  • FF returns null.
  • element#getComputedStyle returns null.
  • The rest of our code is trying to see a string, but instead there's a null, which is propagated further.
  • We can't be sure what'll be caused by this situation. It's possible that even entire editor will be blown up.

So we should rather avoid having FF returning null from native getComputedStyle than allowing silent errors. We need to know the exact case - which element#getComputedStyle call fails.

Last edited 5 years ago by Piotrek Koszuliński (previous) (diff)

comment:7 Changed 5 years ago by Dave G

Hi guys - if you are looking for a reproducible scenario where this issue occurs, then you can use jquery UI tabs. Create 2 tabs and place a ckeditor textarea on the 2nd tab - open the page, and the error appears. Put the ckeditor on the 1st tab, refresh the page and no error appears.

I used the patch at the start of this thread on the 3.6 codeline (3.6.2) and it works okay. Am looking into ckeditor 4 now, and issue occurs there too....not trying the patch yet.

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

Small addition to my last comment. Accidentally I reproduced this issue (on v4 try initializing editor whose parent has display:none), so I tested proposed patch (in fact its corrected version - return '' rather than null). The result was even more scary than I anticipated - complete FF crash because of some inf recursion.

comment:9 Changed 5 years ago by Mark

I'm finding this error in FF 18.0 running in safe mode. Has anyone found a solution for this? Or better yet, has CK been able to reproduce and resolve?

Last edited 5 years ago by Mark (previous) (diff)

comment:10 Changed 5 years ago by Jakub Ś

Status: reopenedpending

Create 2 tabs and place a ckeditor textarea on the 2nd tab

Accidentally I reproduced this issue (on v4 try initializing editor whose parent has display:none)

Both comments talk about same thing CKEditor being dispalyed in display:none element. Please check the attached files - I have tried running them with CKEditor 4, CKEditor 3, in safe mode and in HC mode.

None resulted in error. There has to be something more.

@DaveGYNWA, @Reinmar, @wwalc or anyone else - could you have a look at these samples and tell what have I missed?

NOTE: I have checked this issue in FF 18.0.2. Perhaps this problem has been resolved in that version?

Changed 5 years ago by Jakub Ś

Attachment: _mytest4.html added

Changed 5 years ago by Jakub Ś

Attachment: _mytest3.html added

comment:11 Changed 5 years ago by Dave G

Hey - sorry for delay in getting back on this. Not had a chance to try this myself but will get to it this weekend. I'll let you know results.

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

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