Last Comment Bug 819753 - Rich text editing: undo function broken after insertHTML
: Rich text editing: undo function broken after insertHTML
Status: NEW
Product: Core
Classification: Components
Component: Editor (show other bugs)
: unspecified
: x86 All
-- major with 9 votes (vote)
: ---
Assigned To: Nobody; OK to take it and work on it
: Makoto Kato [:m_kato]
Depends on:
  Show dependency treegraph
Reported: 2012-12-09 03:52 PST by Cacycle
Modified: 2014-05-10 11:23 PDT (History)
5 users (show)
See Also:
Crash Signature:
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Description User image Cacycle 2012-12-09 03:52:36 PST
When using rich text editing in an iframe in designmode, the undo function crashes with the error "NotFoundError: Node was not found" after insertHTML.execCommand('undo') . Sometimes, undo also leads to obviously wrong results, undoing only some of the changes from the last insertHTML command. This bug breaks the undo functionality of the Wikipedia editor wikEd as probably any existing rich text editor implementation. I do not know when this bug has been introduced, but everything worked fine in the past.

Steps to repeat:

1. Go to an online rich text editor, e.g. or
2. Enter some text (if it not already there)
3. Check the "View Source" or "View HTML Source" box and uncheck without changes (this fires an execCommand('insertHTML') command on the whole text)
4. Push the undo button until the console shows the error ("NotFoundError: Node was not found Line 207" or "Error executing command" (error has been catched by the editor script))
Comment 1 User image :Ehsan Akhgari 2012-12-09 10:11:39 PST
Is this a regression?
Comment 2 User image Cacycle 2012-12-09 12:58:11 PST
Comment 3 User image (mostly gone) XtC4UaLL [:xtc4uall] 2012-12-09 13:12:08 PST
I can reproduce with Mozilla/5.0 (Windows NT 6.1; WOW64; rv:2.0.1) Gecko/20100101 Firefox/4.0.1 ID:20110413222027:

Error: uncaught exception: [Exception... "Node was not found"  code: "8" nsresult: "0x80530008 (NS_ERROR_DOM_NOT_FOUND_ERR)"  location: " Line: 207"]

No Error on 1.9.2 Branch/Firefox 3.6.x.
Comment 4 User image Alice0775 White 2013-01-10 01:24:42 PST
The error is shown since at least Firerfox 0.8.
Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.6) Gecko/20040210 Firefox/0.8

Error: uncaught exception: [Exception... "Node was not found"  code: "8" nsresult: "0x80530008 (NS_ERROR_DOM_NOT_FOUND_ERR)"  location: " Line: 207"]

So, I think this is not a regression.
Comment 5 User image Cacycle 2014-05-10 11:23:14 PDT
This bug is still present in 29.0.1 (Mozilla/5.0 (Windows NT 6.3; WOW64; rv:29.0) Gecko/20100101 Firefox/29.0). This bug is a major problem for the Wikipedia editor wikEd where it breaks the pasting buttons (switching between textified and wikified pasted text). I have not yet found a workaround.

Note You need to log in before you can comment on or make changes to this bug.