Closed
Bug 766360
Opened 12 years ago
Closed 12 years ago
"ASSERTION: bad args" with out-of-tree selection, inserthtml
Categories
(Core :: DOM: Editor, defect)
Core
DOM: Editor
Tracking
()
RESOLVED
FIXED
mozilla16
People
(Reporter: jruderman, Assigned: ayg)
References
(Depends on 1 open bug)
Details
(Keywords: assertion, testcase)
Attachments
(3 files)
###!!! ASSERTION: bad args: '(aChild && aParent)', file editor/libeditor/base/nsEditor.cpp, line 3139
Reporter | ||
Comment 1•12 years ago
|
||
aParent is null. (By the way, asserting a conjunction results in vague error logs. I prefer two separate assertions.)
Comment 2•12 years ago
|
||
Aryeh, can you please take a look? Seems easy to fix.
Assignee | ||
Comment 3•12 years ago
|
||
This is another case where we should just be returning false and refusing to try to do anything at all. insertHTML is not enabled here -- bug 760052.
Assignee: nobody → ayg
Status: NEW → ASSIGNED
Assignee | ||
Comment 4•12 years ago
|
||
(But we can do more explicit null-checking too.)
Assignee | ||
Comment 5•12 years ago
|
||
This patch actually keeps the NS_ASSERTION. The real fix is bug 760052, which refuses the run the command to start with in such a pathological case. However, as usual, I rewrote the relevant function while trying to figure out what was happening. This function was pathological even by editor/ standards, particularly the variable naming. There were only three callers. Two ignored the out params and just relied on the fact that the selection would be in roughly the right place, so I got rid of the out params and just put the selection in the right place to start with. In the new function I use both MOZ_ASSERT and NS_ASSERTION, based on how pathological I felt the error case would be. In all cases I also checked for the error in non-debug builds and did basic handling, so that if they do fail we won't crash or anything. Really it would probably make more sense for this to be renamed SplitSelection() or something and the delete part moved out. One of the callers doesn't use the delete behavior anyway because it wants different eStrip/eNoStrip behavior. Try: https://tbpl.mozilla.org/?tree=Try&rev=e28d01ae0a94
Attachment #635210 -
Flags: review?(ehsan)
Updated•12 years ago
|
Attachment #635210 -
Flags: review?(ehsan) → review+
Assignee | ||
Comment 6•12 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/66b3801292a0 This is actually not in the testsuite yet, I just realized. I'll add the testcase to bug 760052, so marking in-testsuite+.
Flags: in-testsuite+
OS: Mac OS X → All
Hardware: x86_64 → All
Target Milestone: --- → mozilla16
Assignee | ||
Comment 7•12 years ago
|
||
Backed out for now: https://hg.mozilla.org/integration/mozilla-inbound/rev/b507d9bfcd04 MOZ_ASSERT(node, "Selection has no ranges in it"); was causing crashtest failures because bug 760052 hasn't landed yet. Will reland after bug 760052.
Target Milestone: mozilla16 → ---
Assignee | ||
Comment 8•12 years ago
|
||
Take two: https://hg.mozilla.org/integration/mozilla-inbound/rev/5cca92dac983
Target Milestone: --- → mozilla16
Comment 9•12 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/5cca92dac983
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•