Closed Bug 1953933 Opened 1 year ago Closed 1 year ago

Crash in [@ mozilla::TextEditor::GetTextNode]

Categories

(Core :: DOM: Editor, defect)

All
Unspecified
defect

Tracking

()

RESOLVED FIXED
138 Branch
Tracking Status
firefox-esr115 --- unaffected
firefox-esr128 --- unaffected
firefox136 --- unaffected
firefox137 --- unaffected
firefox138 + fixed

People

(Reporter: diannaS, Assigned: masayuki)

References

(Regression)

Details

(Keywords: crash, regression)

Crash Data

Attachments

(1 file)

Crash report: https://crash-stats.mozilla.org/report/index/99981d0a-fcbb-4e58-b0c6-e361c0250313

MOZ_CRASH Reason:

MOZ_DIAGNOSTIC_ASSERT(GetRoot())

Top 10 frames:

0  xul.dll  mozilla::TextEditor::GetTextNode()  editor/libeditor/TextEditor.h:267
0  xul.dll  mozilla::TextEditor::GetTextNode() const  editor/libeditor/TextEditor.h:276
0  xul.dll  mozilla::TextEditor::IsEmpty() const  editor/libeditor/TextEditor.cpp:483
1  xul.dll  mozilla::EditorBase::ComputeValueInternal(nsTSubstring<char16_t> const&, unsi...  editor/libeditor/EditorBase.cpp:1430
2  xul.dll  mozilla::TextEditor::ComputeTextValue(unsigned int, nsTSubstring<char16_t>&) ...  editor/libeditor/TextEditor.h:198
3  xul.dll  mozilla::TextControlState::GetValue(nsTSubstring<char16_t>&, bool, bool) const  dom/html/TextControlState.cpp:2537
4  xul.dll  mozilla::TextControlState::PrepareEditor(nsTSubstring<char16_t> const*)  dom/html/TextControlState.cpp:1776
5  xul.dll  mozilla::PrepareEditorEvent::Run()  dom/html/TextControlState.cpp:1576
6  xul.dll  nsContentUtils::RemoveScriptBlocker()  dom/base/nsContentUtils.cpp:6567
6  xul.dll  nsAutoScriptBlocker::~nsAutoScriptBlocker()  dom/base/nsContentUtils.h:3784

:masayuki could this have been caused by bug 1717155?

Flags: needinfo?(masayuki)

Ah, yeah, TextEditor::IsEmpty() starts using GetTextNode().

Assignee: nobody → masayuki
Status: NEW → ASSIGNED
Flags: needinfo?(masayuki)

GetTextNode() requires that the instance has already been initialized since
it requires the native anonymous <div>. And IsEmpty() is a public method.
Therefore, it should return true if there is no editor root, i.e., when it's
not been initialized yet after creation or destroyed.

Additionally, TextControlState::GetValue() should call
TextEditor::ComputeTextValue() if the editor has not been initialized because
it requires the native anonymous subtree to compute the value. I'm not sure
whether this is a bug when <textarea> is being initialized.
(I guess that it should get the default value of the text control element or
mValue in the case, but we should do that in another bug separately.)

I couldn't find the crash testcase, so, this does not contain a new test.

Severity: -- → S2
Pushed by masayuki@d-toybox.com: https://hg.mozilla.org/integration/autoland/rev/db49d0ca59cb Make `TextEditor::IsEmpty()` return `true` if it's not been initialized yet r=m_kato
Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 138 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: