Closed Bug 1779846 Opened 2 years ago Closed 2 years ago

Spell check dialog pops up and disappears instantly when text selection includes the end of the last word before line break or paragraph break

Categories

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

Unspecified
All
defect

Tracking

()

RESOLVED FIXED
106 Branch
Tracking Status
thunderbird_esr91 --- unaffected
thunderbird_esr102 ? affected
firefox-esr102 --- fixed
firefox106 --- fixed

People

(Reporter: bryanwong, Assigned: TYLin)

References

(Blocks 1 open bug, Regression)

Details

(Keywords: regression)

Attachments

(2 files)

Steps to reproduce:

  1. On MacOS (12.4) with Thunderbird version 102.02, select "Write" to compose a new message
  2. Enter some text in the message area of the email composition window.
  3. Highlight and select some text
  4. Select "Spelling" at the top of the message composition window

Actual results:

The check spelling window pops up for a brief second, then disappears right away.

Expected results:

The check spelling window should pop up and remain until closed.

Blocks: tb102found

Thanks bryanwong! Confirming (I came here after seeing this independently when smoketesting TB 105.0b1).

STR

  • Enter some text in compose window (affected versions below, all except TB 91)
  • Select some text which must include the end of the last word before a line break or paragraph break
  • Click Spelling button from toolbar

Actual

  • Spell check dialog just shortly flashes up and then disappears

Expected

  • show spell check dialog for selection (adjusted to full word(s))
  • correct behaviour seen in TB 91

This is a regression - Alice, can you help?

  • Works in TB 91.13.0 (32-bit), Win10.
  • Fails in all other channels:
    • Release 102.2.0 (64-bit)
    • Beta 105.0b1 (64-bit)
    • Daily 106.0a1 (2022-08-24) (64-bit)
Severity: -- → S3
Status: UNCONFIRMED → NEW
Ever confirmed: true
Flags: needinfo?(alice0775)
Priority: -- → P3
Summary: Spell check feature pops up and disappears when highlighting text in message composition window (MacOS) → Spell check dialog pops up and disappears instantly when text selection includes the end of the last word before line break or paragraph break

Thank you Alice. Hmmm, at first sight nothing stands out from the regression range...

(In reply to Thomas D. (:thomas8) from comment #3)

Thank you Alice. Hmmm, at first sight nothing stands out from the regression range...

Maybe bug 1730084 regressed this?

See Also: → 1730084
Regressed by: 1730084
See Also: 1730084

Sorry for the regression. I'll take a look.

Assignee: nobody → aethanyc
Status: NEW → ASSIGNED

(In reply to Ting-Yu Lin [:TYLin] (UTC-8) from comment #5)

Sorry for the regression. I'll take a look.

Thank you very much Ting-Yu Lin for following up on my needinfo from Bug 1730084 Comment 11, that's much appreciated!

This patch fixed a regression caused by Bug 1730084 Part 4
https://phabricator.services.mozilla.com/D125434, which is intended to preserve
the behavior of WordBreaker::FindWord().

Before Bug 1730084 Part 4, WordBreaker::FindWord() returns
[aTextLen + 1, aTextLen + 1] only when aOffset > aTextLen.
But WordBreaker::FindWord() had an assertion aOffset <= aTextLen
to guarantee the caller never passes aOffset > aTextLen. Thus, we can never
go into the if (res.mBegin > strLen) in
TextServicesDocument::OffsetEntryArray::FindWordRange().

However, Bug 1730084 Part 4 wrongly changes the if-statement to
if (range.mEnd == range.mBegin), and makes it reachable when
TextServicesDocument::OffsetEntryArray::FindWordRange() passes
aPos == aLen into WordBreaker::FindWord(). This makes InitSpellChecker()
failed when enableSelectionChecking=true.

This patch deletes the originally unreachable error handling if-statement, and
adds an assertion to guarantee strOffset and strLen is valid.

Pushed by aethanyc@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/8644e2025dbd
Remove an unneeded if-statement in TextServicesDocument::OffsetEntryArray::FindWordRange(). r=masayuki
Regressions: 1789015
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 106 Branch

This is needed for Thunderbird 102esr. Can the patch please be uplifted to esr to fix the regression? Thanks.

Component: Message Compose Window → DOM: Editor
Flags: needinfo?(aethanyc)
OS: Unspecified → All
Product: Thunderbird → Core
Version: Thunderbird 102 → unspecified

Comment on attachment 9292698 [details]
Bug 1779846 - Remove an unneeded if-statement in TextServicesDocument::OffsetEntryArray::FindWordRange().

ESR Uplift Approval Request

  • If this is not a sec:{high,crit} bug, please state case for ESR consideration: This patch fixed the spellchecking when selecting some text. An important usecase when composing email in Thunderbird. See comment 0 for the steps to reproduce the bug.
  • User impact if declined: The spellchecking for selected text is broken if declined.
  • Fix Landed on Version: 106
  • Risk to taking this patch: Low
  • Why is the change risky/not risky? (and alternatives if risky): The patch is small, affecting only the initialization of spellchecking in editor.
Flags: needinfo?(aethanyc)
Attachment #9292698 - Flags: approval-mozilla-esr102?

Comment on attachment 9292698 [details]
Bug 1779846 - Remove an unneeded if-statement in TextServicesDocument::OffsetEntryArray::FindWordRange().

Approved for 102.5esr.

Attachment #9292698 - Flags: approval-mozilla-esr102? → approval-mozilla-esr102+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: