Closed Bug 1734507 Opened 3 years ago Closed 2 years ago

Assertion failure: aEnd.Offset(RawRangeBoundary::OffsetFilter::kValidOffsets).value() == mEditorBase->GetRoot()->Length(), at editor/libeditor/DeleteRangeTransaction.cpp:227

Categories

(Core :: DOM: Editor, defect, P3)

x86_64
Linux
defect

Tracking

()

RESOLVED FIXED
97 Branch
Tracking Status
firefox-esr91 --- wontfix
firefox95 --- wontfix
firefox96 --- wontfix
firefox97 --- fixed

People

(Reporter: MatsPalmgren_bugz, Assigned: masayuki)

References

(Depends on 1 open bug)

Details

(Keywords: assertion)

Crash Data

Attachments

(1 file, 1 obsolete file)

Fwiw, I got this fatal assertion when editing a CSS property value in DevTools (using a local debug build on Linux):

Assertion failure: aEnd.Offset(RawRangeBoundary::OffsetFilter::kValidOffsets).value() == mEditorBase->GetRoot()->Length(), at editor/libeditor/DeleteRangeTransaction.cpp:227

Sorry, I don't have exact STR, nor did I try to reproduce it...

I guess that violation isn't very dangerous, because textNode->TextDataLength() is called afterwards at https://searchfox.org/mozilla-central/rev/477950cf9ca9c9bb5ff6f34e0d0f6ca4718ea798/editor/libeditor/DeleteRangeTransaction.cpp#233-235, but I'm not very familiar with that code.

Kagami: since the violated assertion, https://searchfox.org/mozilla-central/rev/477950cf9ca9c9bb5ff6f34e0d0f6ca4718ea798/editor/libeditor/DeleteRangeTransaction.cpp#225-227, was added by you, could you please set severity and priority for this ticket?

Incidental remark: having MOZ_ASSERT_EQ would be nice.

Flags: needinfo?(krosylight)

Hmm, something does look odd there, but if that doesn't cause a crash on release build I guess it's fine to give S3.

Some work need to be done to make "100% sure nothing does so", so filed bug 1734846.

Severity: -- → S3
Depends on: 1734846
Flags: needinfo?(krosylight)
Priority: -- → P3

Could be caused by the selection selects only the text node, but there is a trailing <br>, e.g., in <textarea>? So, perhaps, the MOZ_ASSERT should check whether it's less than the child count of the root (anonymous <div>)?

That would be also weird since I think we removed trailing <br> from TextEditors 👀

Okay, I got it. If our internal code select from and to outside the text node, i.e., the container is the anonymous <div> element, TextEditor tries to delete the text node due to its completely in the range.

Assignee: nobody → masayuki
Status: NEW → ASSIGNED

Our internal code can touch internal Selection object of <input> and
<textarea>, thus, selection ranges in them may set selection ranges not
in the text node. Therefore, we should make TextEditor instance won't
try to delete ranges which crosses the range boundaries of the text node.

In a followup bug (perhaps, bug 1734846), we should split the deletion code into
TextEditor and HTMLEditor for making the code simpler and never regressed.

Our internal code can touch internal Selection object of <input> and
<textarea>, thus, selection ranges in them may be not in the text node.
Therefore, we should make TextEditor instance try to shrink the deleting
ranges into the text node first.

In a followup bug (perhaps, bug 1734846), we should split the deletion code into
TextEditor and HTMLEditor for making the code simpler and never regressed.

Attachment #9253850 - Attachment is obsolete: true
Pushed by masayuki@d-toybox.com:
https://hg.mozilla.org/integration/autoland/rev/a967b7bb1775
Make `TextEditor` guarantee that ranges to delete are in the text node r=saschanaz
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 97 Branch
Crash Signature: [@ mozilla::TextEditor::SetTextWithoutTransaction]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: