Closed Bug 562623 Opened 14 years ago Closed 8 years ago

queryCommandState results in unaught exception with contenteditable div

Categories

(Core :: DOM: Editor, defect)

x86
Windows 7
defect
Not set
normal

Tracking

()

RESOLVED INCOMPLETE

People

(Reporter: usenet1, Unassigned)

References

(Depends on 1 open bug)

Details

(Keywords: testcase-wanted, Whiteboard: [similar to bug 297494, needs testcase])

Attachments

(1 file)

User-Agent:       Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E)
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 6.1; da; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3

In an attempt to create a small, simple rich text editor, I get this in two instances:

uncaught exception: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIDOMNSHTMLDocument.queryCommandState]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame ::
etc.

It happens every time it reaches either

info=document.queryCommandState("Insertorderedlist");

or 

info=document.queryCommandState("Insertunorderedlist");

or

info=document.queryCommandState("Createlink");

However, does not happen when reaching

info=document.queryCommandState("Justifycenter");
info=document.queryCommandState("Justifyright");
info=document.queryCommandState("Justifyleft");
info=document.queryCommandState("Strikethrough");
info=document.queryCommandState("Underline");
info=document.queryCommandState("Italic");
or
info=document.queryCommandState("Bold");

If I'm not completely mistaken an earlier version of FF (still FF3) on Win XP only did that when reaching info=document.queryCommandState("Createlink");

The div is created by

boxcontents=boxcontents+'<div id="'+n+'" contenteditable="true" style="clear:both;width:496px;height:441px; border:1px #aaaaaa solid;overflow: auto;" onkeyup="getContentInfo(\''+n+'\',this);" onfocus="getContentInfo(\''+n+'\',this);" onclick="getContentInfo(\''+n+'\',this);"></div>';

and the commands that result in this error are in the function getContentInfo

Reproducible: Always
This is similar to bug 297494, except for the part where you say it happens for some commands it worked earlier. Not marking as a duplicate for this reason.

Could you attach a testcase page and maybe tell us what was the last version that didn't throw exceptions for Insertorderedlist and Insertunorderedlist?
Component: General → DOM: Core & HTML
Depends on: 297494
Keywords: regression
QA Contact: general → general
I may have wasted your time, it seems, at least I was wrong about two things: It's not always reproducable, and it would seem it's not a thing that worked in an earlier version and not in this one (coincidences would trick me to believe that). But perhabs some more information could be derived from my struggles to aid in solving this.

I wanted to check to be sure that I could reproduce this yet again, so I created the page http://www.rotary-auktion.dk/page3236.aspx - it's in the environment in which the editor should be used. And sure enough, the exception occured. 

Then I wanted to create a testcase version to attach here, but in that one the exception didn't occur. So I tried creating two more pages to see if I could reproduce it here (http://www.rotary-auktion.dk/page3237.aspx & http://www.rotary-auktion.dk/page3238.aspx) just to see if there was any difference between "inline" and "linked" js, but on both those the exception didn't occur.

I can't figure out what the difference is to make it occur in one instance and not the others
https://developer.mozilla.org/en/Reducing_testcases might help.

Even if you attach a non-minimized standalone page that reproduces the problem here, it would be great, since we won't have to worry about it disappearing before someone has a chance to look at it.

Without a testcase, we can just hope we get it right in bug 297494.
Keywords: regression
Whiteboard: [similar to bug 297494, needs testcase]
Component: DOM: Core & HTML → Editor
QA Contact: general → editor
Keywords: testcase-wanted
I'm seeing the same with Hallo Editor (http://bergie.github.com/hallo/) and Create (http://createjs.org/) quite often. I haven't found a bulletproof way to reproduce it, however.

Here is a simple testcase that doesn't seem to trigger this issue.
Attachment #610487 - Attachment mime type: text/plain → text/html
I tried the test case in Nightly, and I don't get any exceptions reported in the error console.  How do you get the test case to throw?
I was able to reproduce a very similar error (document.queryCommandState('insertOrderedList') threw NS_ERROR_UNEXPECTED) on this page:

http://guardian.github.io/scribe/

The Scribe team has narrowed it down here: https://github.com/guardian/scribe/issues/208
Hi Bruno,

I haven't managed to reproduce this issue on the latest release(44.0.2) nor latest Nightly(47.0a1). Your provided links in comment 2 are no longer available. The attachment from comment 4 does not throw any errors inside the console. The link from comment 6 works as well without any issues. Can you please provide a test case where you encounter this issue?

User Agent: Mozilla/5.0 (Windows NT 6.1; rv:44.0) Gecko/20100101 Firefox/44.0
Build ID: 20160210153822

User Agent: Mozilla/5.0 (Windows NT 6.1; rv:47.0) Gecko/20100101 Firefox/47.0
Build ID: 20160214030236

Also, can you please try to reproduce this on the latest release(44.0.2) and latest Nightly(47.0a1) and provide the results? When doing this, please try to reproduce with a new clean Firefox profile, maybe even in safe mode, as some of this issues may be caused by third party installed add-ons or custom settings(https://support.mozilla.org/en-US/kb/troubleshoot-and-diagnose-firefox-problems).

Thanks,
Paul.
Flags: needinfo?(usenet1)
Marking this as Resolved: Incomplete due to the lack of response from the reporter.
If anyone can still reproduce it on latest versions, feel free to reopen the issue and provide more information.
Status: UNCONFIRMED → RESOLVED
Closed: 8 years ago
Flags: needinfo?(usenet1)
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: