Closed Bug 1725802 Opened 3 years ago Closed 3 years ago

Cannot type text with IME after drag & drop

Categories

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

73 Branch
Desktop
Windows 10
defect

Tracking

()

VERIFIED FIXED
93 Branch
Tracking Status
firefox-esr78 --- wontfix
firefox-esr91 --- wontfix
firefox91 --- wontfix
firefox92 --- wontfix
firefox93 --- verified

People

(Reporter: alice0775, Assigned: masayuki)

References

(Regression)

Details

(Keywords: inputmethod, nightly-community, regression)

Attachments

(1 file)

This bug appears in textarea as well as contenteditable.
Tested with MS IME and ATOP2016.

Steps To Reproduce:

  1. Open data:text/html,<textarea>blabla</textarea><textarea></textarea>
  2. IME on
  3. Select all text in the 1st textarea
  4. Drag & drop the selected text to the 2nd textarea
  5. Optionally click on the 2nd textarea.
  6. Type some text with the IME, and conversion and commit.
  7. Select all text in the 2nd textarea
  8. Drag & drop the selected text to the 1st textarea
  9. Optionally click on the 1st textarea.
  10. Type some text with the IME, and conversion and commit.

Actual Results:
-Composition text does not appear at step 6 & step 10.
-Candidate text popup appears wrong position at step 6. Candidate text popup appears as expected at step 10.
-The commit text does not appear at step 10.

Expected Results:
-The typed text should appear and commit properly.

Regression window:
(On good builds, step 8 does not work, but IME works correctly)
https://hg.mozilla.org/integration/autoland/pushloghtml?fromchange=cae6a2e1838b522f7e940d41db2b61299f9e2b18&tochange=f2637cbcc2ca75be447689fd66baa0e5bfd07c66

Has Regression Range: --- → yes
Has STR: --- → yes
Flags: needinfo?(masayuki)

It seems that IMEStateManager fails to update active editor...

Assignee: nobody → masayuki
Status: NEW → ASSIGNED
Flags: needinfo?(masayuki)
Severity: -- → S3
Priority: -- → P2

The log of IMEStateManager between #4 and #8 of the STR:

# Drag
[Child 38292: Main Thread]: I/IMEStateManager OnClickInEditor(aPresContext=0xb4c0400, aContent=0xe402030, aMouseEvent=0x53fd090), sPresContext=0xb4c0400, sContent=0xe402030, sWidget=0x5843000 (available: true)
[Child 38292: Main Thread]: D/IMEStateManager   OnClickInEditor(), the mouse event isn't a single click event
[Child 38292: Main Thread]: I/IMEStateManager OnMouseButtonEventInEditor(aPresContext=0xb4c0400, aContent=0xe402030, aMouseEvent=0x53fd5b0), sPresContext=0xb4c0400, sContent=0xe402030
[Child 38292: Main Thread]: I/IMEStateManager NotifyIME(aNotification={ mMessage=NOTIFY_IME_OF_MOUSE_BUTTON_EVENT }, aWidget=0x5843000, aBrowserParent=0x0), sFocusedIMEWidget=0x5843000, BrowserParent::GetFocused()=0x0, sFocusedIMEBrowserParent=0x0, aBrowserParent == BrowserParent::GetFocused()=true, aBrowserParent == sFocusedIMEBrowserParent=true, CanSendNotificationToWidget()=true
[Parent 34352: Main Thread]: I/IMEStateManager NotifyIME(aNotification={ mMessage=NOTIFY_IME_OF_MOUSE_BUTTON_EVENT }, aWidget=0x5838000, aBrowserParent=0x23a40800), sFocusedIMEWidget=0x5838000, BrowserParent::GetFocused()=0x23a40800, sFocusedIMEBrowserParent=0x23a40800, aBrowserParent == BrowserParent::GetFocused()=true, aBrowserParent == sFocusedIMEBrowserParent=true, CanSendNotificationToWidget()=true
[Child 38292: Main Thread]: I/IMEStateManager   OnMouseButtonEventInEditor(), mouse event (mMessage=eMouseDown, mButton=0) is not consumed
# Drop
# .focus() from the dropped editor causes `blur`
[Child 38292: Main Thread]: I/IMEStateManager OnChangeFocus(aPresContext=0xb4c0400, aContent=0x0, aCause=CAUSE_UNKNOWN)
[Child 38292: Main Thread]: I/IMEStateManager OnChangeFocusInternal(aPresContext=0xb4c0400 (available: true), aContent=0x0 (remote: false), aAction={ mCause=CAUSE_UNKNOWN, mFocusChange=FOCUS_NOT_CHANGED }), sPresContext=0xb4c0400 (available: true), sContent=0xe402030, sWidget=0x5843000 (available: true), BrowserParent::GetFocused()=0x0, sActiveIMEContentObserver=0xb48ae80, sInstalledMenuKeyboardListener=false, sIsActive=true, restoringContextForRemoteContent=false
[Child 38292: Main Thread]: I/IMEStateManager DestroyIMEContentObserver(), sActiveIMEContentObserver=0xb48ae80
[Child 38292: Main Thread]: D/IMEStateManager   DestroyIMEContentObserver(), destroying the active IMEContentObserver...
[Child 38292: Main Thread]: I/IMEStateManager NotifyIME(aNotification={ mMessage=NOTIFY_IME_OF_BLUR }, aWidget=0x5843000, aBrowserParent=0x0), sFocusedIMEWidget=0x5843000, BrowserParent::GetFocused()=0x0, sFocusedIMEBrowserParent=0x0, aBrowserParent == BrowserParent::GetFocused()=true, aBrowserParent == sFocusedIMEBrowserParent=true, CanSendNotificationToWidget()=true
[Child 38292: Main Thread]: I/IMEStateManager GetNewIMEState(aPresContext=0xb4c0400, aContent=0x0), sInstalledMenuKeyboardListener=false
[Child 38292: Main Thread]: D/IMEStateManager   GetNewIMEState() returns IMEEnabled::Disabled because no content has focus
[Child 38292: Main Thread]: I/IMEStateManager SetIMEState(aState={ mEnabled=DISABLED, mOpen=DONT_CHANGE_OPEN_STATE }, aContent=0x0 (BrowserParent=0x0), aWidget=0x5843000, aAction={ mCause=CAUSE_UNKNOWN, mFocusChange=LOST_FOCUS }, aOrigin=ORIGIN_CONTENT)
[Child 38292: Main Thread]: I/IMEStateManager SetInputContext(aWidget=0x5843000, aInputContext={ mIMEState={ mEnabled=DISABLED, mOpen=DONT_CHANGE_OPEN_STATE }, mOrigin=ORIGIN_CONTENT, mHTMLInputType="", mHTMLInputInputmode="", mActionHint="", mAutocapitalize="", mMayBeIMEUnaware=false, mIsPrivateBrowsing=false }, aAction={ mCause=CAUSE_UNKNOWN_CHROME, mAction=LOST_FOCUS }), BrowserParent::GetFocused()=0x0
# .focus() from the dropped editor causes `focus`
[Child 38292: Main Thread]: I/IMEStateManager OnChangeFocus(aPresContext=0xb4c0400, aContent=0xe4020e0, aCause=CAUSE_UNKNOWN)
[Child 38292: Main Thread]: I/IMEStateManager OnChangeFocusInternal(aPresContext=0xb4c0400 (available: true), aContent=0xe4020e0 (remote: false), aAction={ mCause=CAUSE_UNKNOWN, mFocusChange=FOCUS_NOT_CHANGED }), sPresContext=0xb4c0400 (available: true), sContent=0x0, sWidget=0x5843000 (available: true), BrowserParent::GetFocused()=0x0, sActiveIMEContentObserver=0x0, sInstalledMenuKeyboardListener=false, sIsActive=true, restoringContextForRemoteContent=false
[Child 38292: Main Thread]: I/IMEStateManager GetNewIMEState(aPresContext=0xb4c0400, aContent=0xe4020e0), sInstalledMenuKeyboardListener=false
[Child 38292: Main Thread]: D/IMEStateManager   GetNewIMEState() returns { mEnabled=ENABLED, mOpen=DONT_CHANGE_OPEN_STATE }
[Child 38292: Main Thread]: I/IMEStateManager SetIMEState(aState={ mEnabled=ENABLED, mOpen=DONT_CHANGE_OPEN_STATE }, aContent=0xe4020e0 (BrowserParent=0x0), aWidget=0x5843000, aAction={ mCause=CAUSE_UNKNOWN, mFocusChange=GOT_FOCUS }, aOrigin=ORIGIN_CONTENT)
[Child 38292: Main Thread]: I/IMEStateManager SetInputContext(aWidget=0x5843000, aInputContext={ mIMEState={ mEnabled=ENABLED, mOpen=DONT_CHANGE_OPEN_STATE }, mOrigin=ORIGIN_CONTENT, mHTMLInputType="textarea", mHTMLInputInputmode="", mActionHint="", mAutocapitalize="", mMayBeIMEUnaware=false, mIsPrivateBrowsing=false }, aAction={ mCause=CAUSE_UNKNOWN_CHROME, mAction=GOT_FOCUS }), BrowserParent::GetFocused()=0x0
[Child 38292, Main Thread] WARNING: NS_ENSURE_TRUE(aNextContent && aRange) failed: file m:/src/editor/spellchecker/FilteredContentIterator.cpp:240
[Child 38292: Main Thread]: I/IMEStateManager UpdateIMEState(aNewIMEState={ mEnabled=ENABLED, mOpen=DONT_CHANGE_OPEN_STATE }, aContent=0xe4020e0, aEditorBase=0xd443200), sPresContext=0xb4c0400, sContent=0xe4020e0, sWidget=0x5843000 (available: true), sActiveIMEContentObserver=0x0, sIsGettingNewIMEState=false
[Child 38292: Main Thread]: I/IMEStateManager DestroyIMEContentObserver(), sActiveIMEContentObserver=0x0
[Child 38292: Main Thread]: D/IMEStateManager   DestroyIMEContentObserver() does nothing
[Child 38292: Main Thread]: I/IMEStateManager CreateIMEContentObserver(aEditorBase=0xd443200), sPresContext=0xb4c0400, sContent=0xe4020e0, sWidget=0x5843000 (available: true), sActiveIMEContentObserver=0x0, sActiveIMEContentObserver->IsManaging(sPresContext, sContent)=false
[Child 38292: Main Thread]: D/IMEStateManager   CreateIMEContentObserver() is creating an IMEContentObserver instance...
[Child 38292: Main Thread]: I/IMEStateManager OnFocusInEditor(aPresContext=0xb4c0400, aContent=0xe4020e0, aEditorBase=0xd443200), sPresContext=0xb4c0400, sContent=0xe4020e0, sActiveIMEContentObserver=0xb4ca040
[Child 38292: Main Thread]: I/IMEStateManager DestroyIMEContentObserver(), sActiveIMEContentObserver=0xb4ca040
[Child 38292: Main Thread]: D/IMEStateManager   DestroyIMEContentObserver(), destroying the active IMEContentObserver...
[Child 38292: Main Thread]: I/IMEStateManager CreateIMEContentObserver(aEditorBase=0xd443200), sPresContext=0xb4c0400, sContent=0xe4020e0, sWidget=0x5843000 (available: true), sActiveIMEContentObserver=0x0, sActiveIMEContentObserver->IsManaging(sPresContext, sContent)=false
[Child 38292: Main Thread]: D/IMEStateManager   CreateIMEContentObserver() is creating an IMEContentObserver instance...
[Child 38292: Main Thread]: D/IMEStateManager   OnFocusInEditor(), new IMEContentObserver is created, trying to flush pending notifications...
# Set input context in the main process
[Parent 34352: Main Thread]: I/IMEStateManager NotifyIME(aNotification={ mMessage=NOTIFY_IME_OF_BLUR }, aWidget=0x5838000, aBrowserParent=0x23a40800), sFocusedIMEWidget=0x5838000, BrowserParent::GetFocused()=0x23a40800, sFocusedIMEBrowserParent=0x23a40800, aBrowserParent == BrowserParent::GetFocused()=true, aBrowserParent == sFocusedIMEBrowserParent=true, CanSendNotificationToWidget()=true
[Parent 34352: Main Thread]: I/IMEStateManager SetInputContextForChildProcess(aBrowserParent=0x23a40800, aInputContext={ mIMEState={ mEnabled=DISABLED, mOpen=DONT_CHANGE_OPEN_STATE }, mOrigin=ORIGIN_CONTENT, mHTMLInputType="", mHTMLInputInputmode="", mActionHint="", mAutocapitalize="", mMayBeIMEUnaware=false, mIsPrivateBrowsing=false } , aAction={ mCause=CAUSE_UNKNOWN_CHROME, mAction=LOST_FOCUS }), sPresContext=0xbd30c00 (available: true), sWidget=0x5838000 (available: true), BrowserParent::GetFocused()=0x23a40800, sInstalledMenuKeyboardListener=false
[Parent 34352: Main Thread]: I/IMEStateManager SetInputContext(aWidget=0x5838000, aInputContext={ mIMEState={ mEnabled=DISABLED, mOpen=DONT_CHANGE_OPEN_STATE }, mOrigin=ORIGIN_CONTENT, mHTMLInputType="", mHTMLInputInputmode="", mActionHint="", mAutocapitalize="", mMayBeIMEUnaware=false, mIsPrivateBrowsing=false }, aAction={ mCause=CAUSE_UNKNOWN_CHROME, mAction=LOST_FOCUS }), BrowserParent::GetFocused()=0x23a40800
[Parent 34352: Main Thread]: I/IMEStateManager SetInputContextForChildProcess(aBrowserParent=0x23a40800, aInputContext={ mIMEState={ mEnabled=ENABLED, mOpen=DONT_CHANGE_OPEN_STATE }, mOrigin=ORIGIN_CONTENT, mHTMLInputType="textarea", mHTMLInputInputmode="", mActionHint="", mAutocapitalize="", mMayBeIMEUnaware=false, mIsPrivateBrowsing=false } , aAction={ mCause=CAUSE_UNKNOWN_CHROME, mAction=GOT_FOCUS }), sPresContext=0xbd30c00 (available: true), sWidget=0x5838000 (available: true), BrowserParent::GetFocused()=0x23a40800, sInstalledMenuKeyboardListener=false
[Parent 34352: Main Thread]: I/IMEStateManager SetInputContext(aWidget=0x5838000, aInputContext={ mIMEState={ mEnabled=ENABLED, mOpen=DONT_CHANGE_OPEN_STATE }, mOrigin=ORIGIN_CONTENT, mHTMLInputType="textarea", mHTMLInputInputmode="", mActionHint="", mAutocapitalize="", mMayBeIMEUnaware=false, mIsPrivateBrowsing=false }, aAction={ mCause=CAUSE_UNKNOWN_CHROME, mAction=GOT_FOCUS }), BrowserParent::GetFocused()=0x23a40800
# Double click in the new editor
[Child 38292: Main Thread]: I/IMEStateManager OnMouseButtonEventInEditor(aPresContext=0xb4c0400, aContent=0xe4020e0, aMouseEvent=0x53fd5b0), sPresContext=0xb4c0400, sContent=0xe4020e0
[Child 38292: Main Thread]: D/IMEStateManager   OnMouseButtonEventInEditor(), the active IMEContentObserver isn't managing the editor
[Child 38292: Main Thread]: I/IMEStateManager OnMouseButtonEventInEditor(aPresContext=0xb4c0400, aContent=0xe4020e0, aMouseEvent=0x53fd5b0), sPresContext=0xb4c0400, sContent=0xe4020e0
[Child 38292: Main Thread]: D/IMEStateManager   OnMouseButtonEventInEditor(), the active IMEContentObserver isn't managing the editor
[Child 38292: Main Thread]: I/IMEStateManager OnClickInEditor(aPresContext=0xb4c0400, aContent=0xe4020e0, aMouseEvent=0x53fd090), sPresContext=0xb4c0400, sContent=0xe4020e0, sWidget=0x5843000 (available: true)
[Child 38292: Main Thread]: I/IMEStateManager GetNewIMEState(aPresContext=0xb4c0400, aContent=0xe4020e0), sInstalledMenuKeyboardListener=false
[Child 38292: Main Thread]: D/IMEStateManager   GetNewIMEState() returns { mEnabled=ENABLED, mOpen=DONT_CHANGE_OPEN_STATE }
[Child 38292: Main Thread]: I/IMEStateManager SetIMEState(aState={ mEnabled=ENABLED, mOpen=DONT_CHANGE_OPEN_STATE }, aContent=0xe4020e0 (BrowserParent=0x0), aWidget=0x5843000, aAction={ mCause=CAUSE_MOUSE, mFocusChange=FOCUS_NOT_CHANGED }, aOrigin=ORIGIN_CONTENT)
[Child 38292: Main Thread]: I/IMEStateManager SetInputContext(aWidget=0x5843000, aInputContext={ mIMEState={ mEnabled=ENABLED, mOpen=DONT_CHANGE_OPEN_STATE }, mOrigin=ORIGIN_CONTENT, mHTMLInputType="textarea", mHTMLInputInputmode="", mActionHint="", mAutocapitalize="", mMayBeIMEUnaware=false, mIsPrivateBrowsing=false }, aAction={ mCause=CAUSE_MOUSE, mAction=FOCUS_NOT_CHANGED }), BrowserParent::GetFocused()=0x0
[Parent 34352: Main Thread]: I/IMEStateManager SetInputContextForChildProcess(aBrowserParent=0x23a40800, aInputContext={ mIMEState={ mEnabled=ENABLED, mOpen=DONT_CHANGE_OPEN_STATE }, mOrigin=ORIGIN_CONTENT, mHTMLInputType="textarea", mHTMLInputInputmode="", mActionHint="", mAutocapitalize="", mMayBeIMEUnaware=false, mIsPrivateBrowsing=false } , aAction={ mCause=CAUSE_MOUSE, mAction=FOCUS_NOT_CHANGED }), sPresContext=0xbd30c00 (available: true), sWidget=0x5838000 (available: true), BrowserParent::GetFocused()=0x23a40800, sInstalledMenuKeyboardListener=false
[Parent 34352: Main Thread]: I/IMEStateManager SetInputContext(aWidget=0x5838000, aInputContext={ mIMEState={ mEnabled=ENABLED, mOpen=DONT_CHANGE_OPEN_STATE }, mOrigin=ORIGIN_CONTENT, mHTMLInputType="textarea", mHTMLInputInputmode="", mActionHint="", mAutocapitalize="", mMayBeIMEUnaware=false, mIsPrivateBrowsing=false }, aAction={ mCause=CAUSE_MOUSE, mAction=FOCUS_NOT_CHANGED }), BrowserParent::GetFocused()=0x23a40800
[Parent 34352, Main Thread] WARNING: '!IsSelectionValid()', file m:/src/widget/ContentCache.cpp:667
[Parent 34352, Main Thread] WARNING: '!mContentCache.HandleQueryContentEvent( aEvent, textInputHandlingWidget)', file m:/src/dom/ipc/BrowserParent.cpp:3046
[Parent 34352, Main Thread] WARNING: 'querySelectedTextEvent.DidNotFindSelection()', file m:/src/widget/windows/TSFTextStore.cpp:2928
[Parent 34352, Main Thread] WARNING: '!IsSelectionValid()', file m:/src/widget/ContentCache.cpp:667
[Parent 34352, Main Thread] WARNING: '!mContentCache.HandleQueryContentEvent( aEvent, textInputHandlingWidget)', file m:/src/dom/ipc/BrowserParent.cpp:3046
[Parent 34352, Main Thread] WARNING: 'querySelectedTextEvent.DidNotFindSelection()', file m:/src/widget/windows/TSFTextStore.cpp:2928
[Child 38292: Main Thread]: I/IMEStateManager OnMouseButtonEventInEditor(aPresContext=0xb4c0400, aContent=0xe4020e0, aMouseEvent=0x53fd5b0), sPresContext=0xb4c0400, sContent=0xe4020e0
[Child 38292: Main Thread]: D/IMEStateManager   OnMouseButtonEventInEditor(), the active IMEContentObserver isn't managing the editor
[Child 38292: Main Thread]: I/IMEStateManager OnMouseButtonEventInEditor(aPresContext=0xb4c0400, aContent=0xe4020e0, aMouseEvent=0x53fd5b0), sPresContext=0xb4c0400, sContent=0xe4020e0
[Child 38292: Main Thread]: D/IMEStateManager   OnMouseButtonEventInEditor(), the active IMEContentObserver isn't managing the editor
# Drag from the new editor
[Child 38292: Main Thread]: I/IMEStateManager OnClickInEditor(aPresContext=0xb4c0400, aContent=0xe4020e0, aMouseEvent=0x53fd090), sPresContext=0xb4c0400, sContent=0xe4020e0, sWidget=0x5843000 (available: true)
[Child 38292: Main Thread]: D/IMEStateManager   OnClickInEditor(), the mouse event isn't a single click event
[Child 38292: Main Thread]: I/IMEStateManager OnMouseButtonEventInEditor(aPresContext=0xb4c0400, aContent=0xe4020e0, aMouseEvent=0x53fd5b0), sPresContext=0xb4c0400, sContent=0xe4020e0
[Child 38292: Main Thread]: D/IMEStateManager   OnMouseButtonEventInEditor(), the active IMEContentObserver isn't managing the editor
# Drop in the original editor
# .focus() from the original editor causes `blur`
[Child 38292: Main Thread]: I/IMEStateManager OnChangeFocus(aPresContext=0xb4c0400, aContent=0x0, aCause=CAUSE_UNKNOWN)
[Child 38292: Main Thread]: I/IMEStateManager OnChangeFocusInternal(aPresContext=0xb4c0400 (available: true), aContent=0x0 (remote: false), aAction={ mCause=CAUSE_UNKNOWN, mFocusChange=FOCUS_NOT_CHANGED }), sPresContext=0xb4c0400 (available: true), sContent=0xe4020e0, sWidget=0x5843000 (available: true), BrowserParent::GetFocused()=0x0, sActiveIMEContentObserver=0xb4ca100, sInstalledMenuKeyboardListener=false, sIsActive=true, restoringContextForRemoteContent=false
[Child 38292: Main Thread]: I/IMEStateManager DestroyIMEContentObserver(), sActiveIMEContentObserver=0xb4ca100
[Child 38292: Main Thread]: D/IMEStateManager   DestroyIMEContentObserver(), destroying the active IMEContentObserver...
[Child 38292: Main Thread]: I/IMEStateManager GetNewIMEState(aPresContext=0xb4c0400, aContent=0x0), sInstalledMenuKeyboardListener=false
[Child 38292: Main Thread]: D/IMEStateManager   GetNewIMEState() returns IMEEnabled::Disabled because no content has focus
[Child 38292: Main Thread]: I/IMEStateManager SetIMEState(aState={ mEnabled=DISABLED, mOpen=DONT_CHANGE_OPEN_STATE }, aContent=0x0 (BrowserParent=0x0), aWidget=0x5843000, aAction={ mCause=CAUSE_UNKNOWN, mFocusChange=LOST_FOCUS }, aOrigin=ORIGIN_CONTENT)
[Child 38292: Main Thread]: I/IMEStateManager SetInputContext(aWidget=0x5843000, aInputContext={ mIMEState={ mEnabled=DISABLED, mOpen=DONT_CHANGE_OPEN_STATE }, mOrigin=ORIGIN_CONTENT, mHTMLInputType="", mHTMLInputInputmode="", mActionHint="", mAutocapitalize="", mMayBeIMEUnaware=false, mIsPrivateBrowsing=false }, aAction={ mCause=CAUSE_UNKNOWN_CHROME, mAction=LOST_FOCUS }), BrowserParent::GetFocused()=0x0
# .focus() from the original editor causes `focus`
[Child 38292: Main Thread]: I/IMEStateManager OnChangeFocus(aPresContext=0xb4c0400, aContent=0xe402030, aCause=CAUSE_UNKNOWN)
[Child 38292: Main Thread]: I/IMEStateManager OnChangeFocusInternal(aPresContext=0xb4c0400 (available: true), aContent=0xe402030 (remote: false), aAction={ mCause=CAUSE_UNKNOWN, mFocusChange=FOCUS_NOT_CHANGED }), sPresContext=0xb4c0400 (available: true), sContent=0x0, sWidget=0x5843000 (available: true), BrowserParent::GetFocused()=0x0, sActiveIMEContentObserver=0x0, sInstalledMenuKeyboardListener=false, sIsActive=true, restoringContextForRemoteContent=false
[Child 38292: Main Thread]: I/IMEStateManager GetNewIMEState(aPresContext=0xb4c0400, aContent=0xe402030), sInstalledMenuKeyboardListener=false
[Child 38292: Main Thread]: D/IMEStateManager   GetNewIMEState() returns { mEnabled=ENABLED, mOpen=DONT_CHANGE_OPEN_STATE }
[Child 38292: Main Thread]: I/IMEStateManager SetIMEState(aState={ mEnabled=ENABLED, mOpen=DONT_CHANGE_OPEN_STATE }, aContent=0xe402030 (BrowserParent=0x0), aWidget=0x5843000, aAction={ mCause=CAUSE_UNKNOWN, mFocusChange=GOT_FOCUS }, aOrigin=ORIGIN_CONTENT)
[Child 38292: Main Thread]: I/IMEStateManager SetInputContext(aWidget=0x5843000, aInputContext={ mIMEState={ mEnabled=ENABLED, mOpen=DONT_CHANGE_OPEN_STATE }, mOrigin=ORIGIN_CONTENT, mHTMLInputType="textarea", mHTMLInputInputmode="", mActionHint="", mAutocapitalize="", mMayBeIMEUnaware=false, mIsPrivateBrowsing=false }, aAction={ mCause=CAUSE_UNKNOWN_CHROME, mAction=GOT_FOCUS }), BrowserParent::GetFocused()=0x0
[Parent 34352: Main Thread]: I/IMEStateManager SetInputContextForChildProcess(aBrowserParent=0x23a40800, aInputContext={ mIMEState={ mEnabled=DISABLED, mOpen=DONT_CHANGE_OPEN_STATE }, mOrigin=ORIGIN_CONTENT, mHTMLInputType="", mHTMLInputInputmode="", mActionHint="", mAutocapitalize="", mMayBeIMEUnaware=false, mIsPrivateBrowsing=false } , aAction={ mCause=CAUSE_UNKNOWN_CHROME, mAction=LOST_FOCUS }), sPresContext=0xbd30c00 (available: true), sWidget=0x5838000 (available: true), BrowserParent::GetFocused()=0x23a40800, sInstalledMenuKeyboardListener=false
[Parent 34352: Main Thread]: I/IMEStateManager SetInputContext(aWidget=0x5838000, aInputContext={ mIMEState={ mEnabled=DISABLED, mOpen=DONT_CHANGE_OPEN_STATE }, mOrigin=ORIGIN_CONTENT, mHTMLInputType="", mHTMLInputInputmode="", mActionHint="", mAutocapitalize="", mMayBeIMEUnaware=false, mIsPrivateBrowsing=false }, aAction={ mCause=CAUSE_UNKNOWN_CHROME, mAction=LOST_FOCUS }), BrowserParent::GetFocused()=0x23a40800
[Child 38292: Main Thread]: I/IMEStateManager OnFocusInEditor(aPresContext=0xb4c0400, aContent=0xe402030, aEditorBase=0xd443110), sPresContext=0xb4c0400, sContent=0xe402030, sActiveIMEContentObserver=0x0
[Child 38292: Main Thread]: I/IMEStateManager CreateIMEContentObserver(aEditorBase=0xd443110), sPresContext=0xb4c0400, sContent=0xe402030, sWidget=0x5843000 (available: true), sActiveIMEContentObserver=0x0, sActiveIMEContentObserver->IsManaging(sPresContext, sContent)=false
[Child 38292: Main Thread]: D/IMEStateManager   CreateIMEContentObserver() is creating an IMEContentObserver instance...
[Child 38292: Main Thread]: D/IMEStateManager   OnFocusInEditor(), new IMEContentObserver is created, trying to flush pending notifications...
[Parent 34352: Main Thread]: I/IMEStateManager SetInputContextForChildProcess(aBrowserParent=0x23a40800, aInputContext={ mIMEState={ mEnabled=ENABLED, mOpen=DONT_CHANGE_OPEN_STATE }, mOrigin=ORIGIN_CONTENT, mHTMLInputType="textarea", mHTMLInputInputmode="", mActionHint="", mAutocapitalize="", mMayBeIMEUnaware=false, mIsPrivateBrowsing=false } , aAction={ mCause=CAUSE_UNKNOWN_CHROME, mAction=GOT_FOCUS }), sPresContext=0xbd30c00 (available: true), sWidget=0x5838000 (available: true), BrowserParent::GetFocused()=0x23a40800, sInstalledMenuKeyboardListener=false
[Parent 34352: Main Thread]: I/IMEStateManager SetInputContext(aWidget=0x5838000, aInputContext={ mIMEState={ mEnabled=ENABLED, mOpen=DONT_CHANGE_OPEN_STATE }, mOrigin=ORIGIN_CONTENT, mHTMLInputType="textarea", mHTMLInputInputmode="", mActionHint="", mAutocapitalize="", mMayBeIMEUnaware=false, mIsPrivateBrowsing=false }, aAction={ mCause=CAUSE_UNKNOWN_CHROME, mAction=GOT_FOCUS }), BrowserParent::GetFocused()=0x23a40800

Starting composition after this does not reach IMEStateManager::DispatchCompositionEvent. According to this log, input context is set as expected. However, the IMEContentObserver does not work.

The root cause of the bug is that
IMEContentObserver::FlushMergeableNotifications() does not enqueue focus
notification for IME here:
https://searchfox.org/mozilla-central/rev/5a362eb7d054740dc9d7c82c79a2efbc5f3e4776/dom/events/IMEContentObserver.cpp#1350-1351,1357
because editor is handling an edit action to insert dropped content:
https://searchfox.org/mozilla-central/rev/5a362eb7d054740dc9d7c82c79a2efbc5f3e4776/dom/events/IMEContentObserver.cpp#1343
https://searchfox.org/mozilla-central/rev/5a362eb7d054740dc9d7c82c79a2efbc5f3e4776/editor/libeditor/EditorBase.cpp#4466-4468
but focus is changed to the editor:
https://searchfox.org/mozilla-central/rev/5a362eb7d054740dc9d7c82c79a2efbc5f3e4776/editor/libeditor/EditorBase.cpp#4552-4554
and then, "focus" event listener of editor calls
IMEStateManager::OnFocusInEditor():
https://searchfox.org/mozilla-central/rev/5a362eb7d054740dc9d7c82c79a2efbc5f3e4776/editor/libeditor/EditorEventListener.cpp#1160
and it tries to send focus notification of IME again:
https://searchfox.org/mozilla-central/rev/5a362eb7d054740dc9d7c82c79a2efbc5f3e4776/dom/events/IMEStateManager.cpp#843
but IMEContentObserver::TryToFlushPendingNotifications() does noting because
its mQueuedSender is nullptr:
https://searchfox.org/mozilla-central/rev/5a362eb7d054740dc9d7c82c79a2efbc5f3e4776/dom/events/IMEContentObserver.cpp#1413

At the first point (FlushMergeableNotifications()), mQueuedSender is not
set by design. However, this is not handled correctly in the last point
(TryToFlushPendingNotifications()). If there are some pending notifications,
it needs to create a sender by itself and make it run.

Then, native IME handler starts to work normally with the focused editor. I.e.,
this is a bug of that IMEContentObserver is not ready for new focused editor
and native IME context is also not ready. Therefore, this is not testable with
synthesizeCompositionChange API of EventUtils.js. However, I succeeded to
detect the bug with nsITextInputProcessorCallback which notifies JS of
notifications for IME.

Pushed by masayuki@d-toybox.com: https://hg.mozilla.org/integration/autoland/rev/a75035552058 Make `IMEContentObserver` create a sender of notifications when there are pending notifications, but not in the queue r=smaug
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 93 Branch
Flags: qe-verify+

Reproduced this issue on an affected Nightly build, 93.0a1 (20210814211132), with the steps from comment 0.

The issue is not reproducing anymore on Beta 93.0b7 with Windows 10 x64.

Status: RESOLVED → VERIFIED
Flags: qe-verify+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: