Closed
Bug 1052230
Opened 10 years ago
Closed 10 years ago
IMEContentObserver shouldn't flush pending notifications again during flushing notifications
Categories
(Core :: DOM: UI Events & Focus Handling, defect)
Core
DOM: UI Events & Focus Handling
Tracking
()
RESOLVED
FIXED
mozilla34
People
(Reporter: masayuki, Assigned: masayuki)
References
Details
(Keywords: inputmethod)
Attachments
(1 file, 1 obsolete file)
6.35 KB,
patch
|
smaug
:
review+
|
Details | Diff | Splinter Review |
Currently, IMEContentObserver dispatches runnable events which notify IME of something *before* clearing "pending to dispatch" flag. Therefore, if the method is called recursively, same runnable event (i.e., it has been being dispatched) may be dispatched again.
Assignee | ||
Comment 1•10 years ago
|
||
Attachment #8471355 -
Flags: review?(bugs)
Comment 2•10 years ago
|
||
Comment on attachment 8471355 [details] [diff] [review] Patch >+ // If we're in handling an edit action, this method will be called later. >+ // If this is already detached from the widget, this don't need to notify s/don't/doesn't/ >+ // Notifying something may cause nested call of this method. For example, >+ // when somebody notified one of the notifications may dispatch query content >+ // event. Then, it causes flushing layout which may cause another layout >+ // change notification. >+ >+ if (mIsFlushingPendingNotifications) { >+ // So, if this is already called, this should do nothing. >+ return; >+ } >+ >+ mIsFlushingPendingNotifications = true; Perhaps use mozilla::AutoRestore here. >+ // If notifications may cause new change, we should notify them now. >+ if (mTextChangeData.mStored || >+ mIsSelectionChangeEventPending || >+ mIsPositionChangeEventPending) { >+ FlushMergeableNotifications(); > } Hmm, isn't it possible that we end up to endless recursion here Explain why recursion couldn't be an issue and ask re-review, or fix the possible issue. (I could imagine there might be a case where we just need to call FlushMergeableNotifications asynchronously to break the recursion.)
Attachment #8471355 -
Flags: review?(bugs) → review-
Assignee | ||
Comment 3•10 years ago
|
||
(In reply to Olli Pettay [:smaug] from comment #2) > >+ // If notifications may cause new change, we should notify them now. > >+ if (mTextChangeData.mStored || > >+ mIsSelectionChangeEventPending || > >+ mIsPositionChangeEventPending) { > >+ FlushMergeableNotifications(); > > } > Hmm, isn't it possible that we end up to endless recursion here > Explain why recursion couldn't be an issue and ask re-review, or fix the > possible issue. > (I could imagine there might be a case where we just need to call > FlushMergeableNotifications asynchronously to break the > recursion.) Ah, could be. But I think that TextChange and SelectionChange should be notified synchronously as far as possible... On the other hand, I don't have idea to make infinite recursion. I'll create a patch which dispatches the events asynchronously.
Comment 4•10 years ago
|
||
I think the initial FlushMergeableNotifications could happen sync, but possible nested ones async.
Assignee | ||
Comment 5•10 years ago
|
||
Attachment #8471355 -
Attachment is obsolete: true
Attachment #8472151 -
Flags: review?(bugs)
Updated•10 years ago
|
Attachment #8472151 -
Flags: review?(bugs) → review+
Assignee | ||
Comment 6•10 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/3d44580bc427
Comment 7•10 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/3d44580bc427
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla34
Updated•5 years ago
|
Component: Event Handling → User events and focus handling
You need to log in
before you can comment on or make changes to this bug.
Description
•