Open Bug 772668 Opened 8 years ago Updated 7 years ago

"ASSERTION: aNode isn't in mRange, or something else weird happened" after failed justifyright

Categories

(Core :: DOM: Editor, defect)

x86_64
macOS
defect
Not set

Tracking

()

People

(Reporter: jruderman, Unassigned)

References

(Blocks 1 open bug)

Details

(Keywords: assertion, testcase)

Attachments

(2 files)

Attached file testcase
###!!! ASSERTION: aNode isn't in mRange, or something else weird happened: 'NS_SUCCEEDED(res) && !nodeBefore && !nodeAfter', file content/base/src/nsContentIterator.cpp, line 1437
Attached file stack trace
The test case seems awfully obfuscated.  If you're going to use DOM methods instead of just an HTML serialization, you can do stuff like

  document.documentElement.setAttributeNS(null, "contenteditable", "true");
  allNodes[1] = document.createElementNS("http://www.w3.org/1999/xhtml", "div");
  allNodes[1].setAttributeNS(null, "contenteditable", "false");
  allNodes[2] = document.createTextNode("x");
  (allNodes[1] || document.documentElement).appendChild(allNodes[2]);

->

  document.documentElement.contentEditable = true;
  var div = document.createElement("div");
  div.contentEditable = false;
  div.appendChild(document.createTextNode("x"));

What's the || business there even supposed to do?  allNodes[1] is certainly not null, so everything after it will just be ignored . . .

Similarly, this

  window.getSelection().removeAllRanges();
  r0 = document.createRange();
  r0.setStart(allNodes[3], 1);
  r0.setEnd(allNodes[3], 1);
  window.getSelection().addRange(r0);

could be just

  getSelection().collapse(allNodes[3], 1);

This kind of change would make the tests a lot easier to understand . . .
Jesse's test cases are usually auto-generated using a fuzzer.  :-)
Yeah, I usually make those kinds of transformations manually before filing bugs.

This is roughly the form I use for automated reduction.  (The "||" allows the children of a removed node to remain in the document, for example.)
The fix for bug 887631 didn't take care of this one, fwiw.
You need to log in before you can comment on or make changes to this bug.