Rich text editing: undo function broken after insertHTML




5 years ago
4 months ago


(Reporter: Cacycle, Unassigned)


Firefox Tracking Flags

(Not tracked)


(Whiteboard: [dupeme])



5 years ago
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))
Component: General → Editor
Product: Firefox → Core
Whiteboard: [dupeme]
Is this a regression?

Comment 2

5 years ago
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.
Keywords: regression, regressionwindow-wanted

Comment 4

5 years ago
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.
Ever confirmed: true
Keywords: regression, regressionwindow-wanted

Comment 5

3 years ago
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.
OS: Windows XP → All

Comment 6

4 months ago
This bug is still present in 52.0.1 (!) (Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Firefox/52.0) and is still a problem. Anybody willing to work on this?


4 months ago
Priority: -- → P3
You need to log in before you can comment on or make changes to this bug.