Граф коммитов

132 Коммитов

Автор SHA1 Сообщение Дата
Masayuki Nakano e28f43b439 Bug 1825693 - Make `ContentCacheInChild::CacheTextRects` stop emplacing `Selection` r=m_kato
It creates no range `Selection` if `mSelection` has not been emplaced.
However, we don't want `Selection` in the case because `mText` may be nothing
and that violates the dependency.  Therefore, it should stop creating
`Selection` in the case.

Note that first character rect will be cached later even if there is no
`Selection`.  However, this should not occur in usual case because `focus`
notification should've already initialized `mText` and `mSelection`.

Differential Revision: https://phabricator.services.mozilla.com/D178731
2023-05-26 01:24:36 +00:00
Masayuki Nakano 5f53d66d00 Bug 1825693 - Make `PuppetWidget` stop trying to cache `Selection` directly r=m_kato
Currently, `PuppetWidget` calls `ContentCacheInChild::CacheSelection` directly.
However, `mText` can be `Nothing` or `mText` can be outdated, but `mSelection`
becomes the latest one.  Therefore, we may notify the parent process with
invalid data combination.

The callers in `PuppetWidget` are:
1. `NotifyIMEOfCompositionUpdate`
2. `NotifyIMEOfPositionChange`

I think that the former does not need to cache anything here because
`IMEContentObserver` should've updated the text/selection changes.  However,
stopping caching everything at this point is risky.  In the most cases, outdated
data appears as odd IME UI position.  Therefore, let's keep updating only caret
and text rectangles.

The latter is reported with new crash reports which is crashed by a
`MOZ_DIAGNOSTIC_ASSERT` failure added by the previous patch.  In the case,
if `mText` and `mSelection` has not been cached, we don't need to notify
the parent process with them because they will be sent later.  And also even
if they are not available, it may be useful that the character rectangles not
related to `Selection` (e.g., the first character rect).  Therefore, let's
keep caching same things as the former case.

Therefore, this patch makes `CacheSelection` a private method and add
`CacheCaretAndTextRects` for them.

Differential Revision: https://phabricator.services.mozilla.com/D178145
2023-05-26 01:24:36 +00:00
Masayuki Nakano 4c5f7cf636 Bug 1825693 - Make `ContentCache` stop assigning invalid data r=m_kato,nika
There are some crash reports crashed in TSF module which may be caused by
passing invalid selection range (e.g., out of bounds of text).  However,
the cache is created in the child process and that causes the invalid cache
creation does not appear in the crash reports.  Therefore, let's try to
crash as soon as possible if `ContentCache` has invalid data.

Note that this does not detect all of the invalid cases because it's hard to
(re-)understand the edge cases.  Therefore, this tries to detect the cases
checked in `ContentCacheInParent::HandleQueryContentEvent` (*1) and some other
obvious odd cases.

1. https://searchfox.org/mozilla-central/rev/0ffaecaa075887ab07bf4c607c61ea2faa81b172/widget/ContentCache.cpp#776-778

Differential Revision: https://phabricator.services.mozilla.com/D176747
2023-05-26 01:24:35 +00:00
Iulian Moraru 645bd13854 Backed out 2 changesets (bug 1825693) for causing reftest failures related to ContentCache::Selection. CLOSED TREE
Backed out changeset 6a854fc8f509 (bug 1825693)
Backed out changeset f0646a32d694 (bug 1825693)
2023-05-19 04:15:46 +03:00
Masayuki Nakano 718cc92528 Bug 1825693 - Make `PuppetWidget` stop trying to cache `Selection` directly r=m_kato
Currently, `PuppetWidget` calls `ContentCacheInChild::CacheSelection` directly.
However, `mText` can be `Nothing` or `mText` can be outdated, but `mSelection`
becomes the latest one.  Therefore, we may notify the parent process with
invalid data combination.

The callers in `PuppetWidget` are:
1. `NotifyIMEOfCompositionUpdate`
2. `NotifyIMEOfPositionChange`

I think that the former does not need to cache anything here because
`IMEContentObserver` should've updated the text/selection changes.  However,
stopping caching everything at this point is risky.  In the most cases, outdated
data appears as odd IME UI position.  Therefore, let's keep updating only caret
and text rectangles.

The latter is reported with new crash reports which is crashed by a
`MOZ_DIAGNOSTIC_ASSERT` failure added by the previous patch.  In the case,
if `mText` and `mSelection` has not been cached, we don't need to notify
the parent process with them because they will be sent later.  And also even
if they are not available, it may be useful that the character rectangles not
related to `Selection` (e.g., the first character rect).  Therefore, let's
keep caching same things as the former case.

Therefore, this patch makes `CacheSelection` a private method and add
`CacheCaretAndTextRects` for them.

Depends on D176747

Differential Revision: https://phabricator.services.mozilla.com/D178145
2023-05-18 23:56:07 +00:00
Masayuki Nakano a6448bb218 Bug 1825693 - Make `ContentCache` stop assigning invalid data r=m_kato,nika
There are some crash reports crashed in TSF module which may be caused by
passing invalid selection range (e.g., out of bounds of text).  However,
the cache is created in the child process and that causes the invalid cache
creation does not appear in the crash reports.  Therefore, let's try to
crash as soon as possible if `ContentCache` has invalid data.

Note that this does not detect all of the invalid cases because it's hard to
(re-)understand the edge cases.  Therefore, this tries to detect the cases
checked in `ContentCacheInParent::HandleQueryContentEvent` (*1) and some other
obvious odd cases.

1. https://searchfox.org/mozilla-central/rev/0ffaecaa075887ab07bf4c607c61ea2faa81b172/widget/ContentCache.cpp#776-778

Differential Revision: https://phabricator.services.mozilla.com/D176747
2023-05-18 23:56:06 +00:00
Noemi Erli 71d235742a Backed out changeset 4f6d49b8d207 (bug 1825693) for ContentCache crashes 2023-05-16 00:29:31 +03:00
Masayuki Nakano f9157293e3 Bug 1825693 - Make `ContentCache` stop assigning invalid data r=m_kato,nika
There are some crash reports crashed in TSF module which may be caused by
passing invalid selection range (e.g., out of bounds of text).  However,
the cache is created in the child process and that causes the invalid cache
creation does not appear in the crash reports.  Therefore, let's try to
crash as soon as possible if `ContentCache` has invalid data.

Note that this does not detect all of the invalid cases because it's hard to
(re-)understand the edge cases.  Therefore, this tries to detect the cases
checked in `ContentCacheInParent::HandleQueryContentEvent` (*1) and some other
obvious odd cases.

1. https://searchfox.org/mozilla-central/rev/0ffaecaa075887ab07bf4c607c61ea2faa81b172/widget/ContentCache.cpp#776-778

Differential Revision: https://phabricator.services.mozilla.com/D176747
2023-05-15 02:01:06 +00:00
Masayuki Nakano 11e6b5ed0f Bug 1810620 - Make `ContentCacheInChild::CacheTextRects` check `mSelection.isSome()` at logging it r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D166980
2023-01-18 01:32:55 +00:00
Christian Holler 555e8f7574 Bug 1781044 - Disable some diagnostic asserts in widget for IPC fuzzing. r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D152639
2022-07-26 14:06:24 +00:00
Masayuki Nakano 91e18f14d8 Bug 1760160 - Make `ContentCacheInChild` stop storing content if editable element has already been blurred r=m_kato
It's designed for caching content information of focused editor.  However, at
sending focus notification to the main process, the editor may have already
been blurred but `IMEContentObserver` may have not known it yet.  In this edge
case, only query selection succeeds since IMEContentObserver still has a cache,
but query the others failed because of root content node check of
`IMEContentObserver::HandleQueryContentEvent`.  If a content process meets this
case, it should not send focus notification and stop storing the content since
IME shouldn't get focus nor query non-editable content.

On the other hand, the reported testcase reproduces this with a fuzzing API
called **in** the content process. Therefore, I have no idea how to reproduce
it without the API. That's the reason why this patch does not contain new tests.

Differential Revision: https://phabricator.services.mozilla.com/D141821
2022-04-07 00:58:49 +00:00
Masayuki Nakano e1ad4921b9 Bug 1755438 - Make `ContentCacheInParent::GetTextRect` check `mSelection` before referring it r=m_kato
Unfortunately, the adding test cannot reproduce the crash, but I have no idea
how to make `mSelection` being `Nothing` until next native event loop.  Anyway,
it's worthwhile to add new tests.

This patch just avoids `ContentCacheInParent::GetTextRect` referring
`mSelection` when there is no text rects and `mSelection` is `Nothing`.

Differential Revision: https://phabricator.services.mozilla.com/D138876
2022-02-17 08:53:35 +00:00
Masayuki Nakano 956a5e7150 Bug 1752956 - Make `IMEContentObserver` invalidate selection cache when it gets DOM mutations r=m_kato
Oddly, in some complicated web apps, `IMEContentObserver` may get selection
change notifications **after** sending a text change notification to IME.
However, I cannot reproduce it with simple testcase.  Therefore, the new test
does not test the original issue, but the approach of this patch must avoid
regressions of this special case handling.

Differential Revision: https://phabricator.services.mozilla.com/D137522
2022-02-08 00:13:21 +00:00
Masayuki Nakano 1f3b6b7927 Bug 1746104 - part 6-5: Make `ContentCache` not stop caching other data when it fails caching something r=m_kato
Currently, `mSelection` is cached only when `mText` is some, text rects are
cached only when `mSelection` is cached.  However, as far as widget can work
with IME, it should cache content as far as possible.  Therefore, this patch
makes it keep querying content data even after something fails.

Differential Revision: https://phabricator.services.mozilla.com/D137431
2022-02-07 22:33:41 +00:00
Masayuki Nakano 31390e88e6 Bug 1746104 - part 6-4: Make `ContentCacheInParent` and `ContentCacheInChild` handle the case there is no selection range r=m_kato
Even after applying this patch, it still returns error when queried with a
relative offset from selection and only when there is no composition string.
However, this shouldn't cause any problem because in this case, widget should
not try to query content with relative offset.

Differential Revision: https://phabricator.services.mozilla.com/D137430
2022-02-07 22:33:40 +00:00
Masayuki Nakano 55bc376f36 Bug 1746104 - part 6-3: Wrap `ContentCache::mText` with `Maybe` r=m_kato
For managing the state of text content cache independent from selection, it
should be wrapped with `Maybe`.

Differential Revision: https://phabricator.services.mozilla.com/D137429
2022-02-07 22:33:40 +00:00
Masayuki Nakano 47397b7081 Bug 1746104 - part 6-2: Make constructors of `ContentCache::Selection` take `IMENotification::SelectionChangeData` or `WidgetQueryContentEvent` r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D137428
2022-02-07 22:33:40 +00:00
Masayuki Nakano d19b353c60 Bug 1746104 - part 6-0: Clean up logging code in `ContentCache.cpp` r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D137426
2022-02-07 22:33:39 +00:00
Masayuki Nakano fd30eaf365 Bug 1746104 - part 5-1: Get rid of `WidgetQueryContentEvent::Reply::mHasSelection` r=m_kato
It's intended to indicate whether the selection is collapsed or not, but it can
be referred by other members, there is no reasonable user and the name makes
developers confused.

Differential Revision: https://phabricator.services.mozilla.com/D137422
2022-02-07 22:33:37 +00:00
Nika Layzell 7b2e6d4996 Bug 1741665 - Align nsCString's public size_type better with other C++ APIs, r=mccr8,geckoview-reviewers,agi
Differential Revision: https://phabricator.services.mozilla.com/D131422
2021-12-13 21:47:56 +00:00
Masayuki Nakano 8e022b15e5 Bug 1683226 - part 4: Make stop `ContentCache` check whether a plugin has focus or not r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D100103
2020-12-21 05:59:57 +00:00
Masayuki Nakano 912a5bc76d Bug 1678553 - part 13: Make `WidgetQueryContentEvent` use `Maybe` to store some data r=m_kato,geckoview-reviewers
Sorry for this big patch.

This makes `WidgetQueryContentEvent::Reply` is stored with `Maybe` to get
rid of `WidgetQueryContentEvent`.  And `Reply` stores offset and string
with `Maybe` and ``OffsetAndData<uint32_t>`, and also tentative caret offset
with `Maybe`.  Then, we can get rid of `WidgetQueryContentEvent::NOT_FOUND`.

Note that I tried to make `OffsetAndData` have a method to create `NSRange`
for cocoa widget.  However, it causes the column limit`to 100 or longer
and that causes unrelated changes in `TextEvents.h` and `IMEData.h`.
Therefore, I create an inline function in `TextInputHandler.mm` instead.

Differential Revision: https://phabricator.services.mozilla.com/D98264
2020-12-02 05:32:19 +00:00
Masayuki Nakano 88f679f680 Bug 1678553 - part 12: Make `ContentCache` store character rects with `Maybe` r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D97981
2020-11-27 14:48:03 +00:00
Masayuki Nakano 6401c74b8d Bug 1678553 - part 11: Make `ContentCache` store its `Caret` with `Maybe` r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D97980
2020-11-27 14:47:50 +00:00
Masayuki Nakano 0c4e9ae15a Bug 1678553 - part 10: Make `ContentCache` store its `Selection` with `Maybe` r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D97979
2020-11-27 14:47:37 +00:00
Masayuki Nakano a6bd766fba Bug 1678553 - part 9: Make `ContentCacheInChild` store last commit start offset and commit string with `Maybe` and `OffsetAndData` r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D97978
2020-11-27 14:47:30 +00:00
Narcis Beleuzu dae9de02cd Backed out 2 changesets (bug 1678553) for MinGW bustages on ToString.h
Backed out changeset a21c164db6ff (bug 1678553)
Backed out changeset 2f95b040da6c (bug 1678553)
2020-11-27 16:35:26 +02:00
Masayuki Nakano 882b891cbe Bug 1678553 - part 9: Make `ContentCacheInChild` store last commit start offset and commit string with `Maybe` and `OffsetAndData` r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D97978
2020-11-27 06:39:59 +00:00
Masayuki Nakano 85b84f8248 Bug 1677684 - part 2: Make `ContentCache` cache character rects in last commit composition string for undoing the commit r=m_kato
Usually, IME sets selection and considers candidate list position at starting
new composition.  However, Apple Japanese IME sometimes consider the candidate
list position at retrieving the character rects before setting selection.
Therefore, we need to store last commit string's character rects, but don't
need to store it in long time because Kakutei-Undo is supported by Japanese
IMEs and they work only immediately after committing a composition.  E.g.,
after moving caret, it won't be available.

Depends on D97838

Differential Revision: https://phabricator.services.mozilla.com/D97839
2020-11-24 01:31:46 +00:00
Masayuki Nakano 0869a8137b Bug 1677684 - part 1: Make `ContentCache` manage composition start offset with `Maybe` instead of using a magic number r=m_kato
Currently, it manages the composition start offset with `uint32_t` and setting
it to `UINT32_MAX` when there is no composition.  But this is now rewritable
with `Maybe<uint32_t>` for easier to read.

Differential Revision: https://phabricator.services.mozilla.com/D97838
2020-11-23 09:29:34 +00:00
Masayuki Nakano fbf626bd55 Bug 1677926 - Make `TSFTextStore::GetTextExt()` consider whether it can query content with relative offset from last composition start with `TextEventDispatcher::IsComposing()` r=m_kato
Immediately after committing composition, i.e., still remote content is
handling the commit, `ContentCacheInParent` does not think that it still
has composition, but `TSFTextStore::GetTextExt()` tries a query whose offset
is relative offset from the last composition start offset and then,
`ContentCacheInParent` solves it with selection start (typically, the last
composition end offset).  Therefore, this may cause returning error from
`GetTextExt()` and some TIP may fail to do something for next typing.

This patch makes `TSFTextStore::GetTextExt()` consider whether it'll query
content with relative offset from last composition start or selection start,
from `TextEventDispatcher::IsComposing()` result rather than
`TextEventDispatcher::IsHandlingComposition()` since the former means whether
there is composition in the chrome process, but the latter is there is
composition in focused process, and `ContentCacheInParent` state matches the
former.

Depends on D97270

Differential Revision: https://phabricator.services.mozilla.com/D97392
2020-11-19 09:34:45 +00:00
Simon Giesecke cb0734d274 Bug 1613985 - Use default for equivalent-to-default constructors/destructors in widget. r=jmathies
Differential Revision: https://phabricator.services.mozilla.com/D66012

--HG--
extra : moz-landing-system : lando
2020-03-16 10:56:57 +00:00
Bogdan Tara c60fd3fdd2 Backed out 4 changesets (bug 1613985) for causing build bustages CLOSED TREE
Backed out changeset fba0caac746c (bug 1613985)
Backed out changeset 8605d7a19107 (bug 1613985)
Backed out changeset 41e858fbf235 (bug 1613985)
Backed out changeset 847433cf1e0a (bug 1613985)
2020-03-16 12:41:41 +02:00
Simon Giesecke 2d961c08ab Bug 1613985 - Use default for equivalent-to-default constructors/destructors in widget. r=jmathies
Differential Revision: https://phabricator.services.mozilla.com/D66012

--HG--
extra : moz-landing-system : lando
2020-03-16 09:14:12 +00:00
Emilio Cobos Álvarez 256c124f94 Bug 1609996 - Reorder some includes affected by the previous patches. r=froydnj
This was done by:

This was done by applying:

```
diff --git a/python/mozbuild/mozbuild/code-analysis/mach_commands.py b/python/mozbuild/mozbuild/code-analysis/mach_commands.py
index 789affde7bbf..fe33c4c7d4d1 100644
--- a/python/mozbuild/mozbuild/code-analysis/mach_commands.py
+++ b/python/mozbuild/mozbuild/code-analysis/mach_commands.py
@@ -2007,7 +2007,7 @@ class StaticAnalysis(MachCommandBase):
         from subprocess import Popen, PIPE, check_output, CalledProcessError

         diff_process = Popen(self._get_clang_format_diff_command(commit), stdout=PIPE)
-        args = [sys.executable, clang_format_diff, "-p1", "-binary=%s" % clang_format]
+        args = [sys.executable, clang_format_diff, "-p1", "-binary=%s" % clang_format, '-sort-includes']

         if not output_file:
             args.append("-i")
```

Then running `./mach clang-format -c <commit-hash>`

Then undoing that patch.

Then running check_spidermonkey_style.py --fixup

Then running `./mach clang-format`

I had to fix four things:

 * I needed to move <utility> back down in GuardObjects.h because I was hitting
   obscure problems with our system include wrappers like this:

0:03.94 /usr/include/stdlib.h:550:14: error: exception specification in declaration does not match previous declaration
0:03.94 extern void *realloc (void *__ptr, size_t __size)
0:03.94              ^
0:03.94 /home/emilio/src/moz/gecko-2/obj-debug/dist/include/malloc_decls.h:53:1: note: previous declaration is here
0:03.94 MALLOC_DECL(realloc, void*, void*, size_t)
0:03.94 ^
0:03.94 /home/emilio/src/moz/gecko-2/obj-debug/dist/include/mozilla/mozalloc.h:22:32: note: expanded from macro 'MALLOC_DECL'
0:03.94     MOZ_MEMORY_API return_type name##_impl(__VA_ARGS__);
0:03.94                                ^
0:03.94 <scratch space>:178:1: note: expanded from here
0:03.94 realloc_impl
0:03.94 ^
0:03.94 /home/emilio/src/moz/gecko-2/obj-debug/dist/include/mozmemory_wrap.h:142:41: note: expanded from macro 'realloc_impl'
0:03.94 #define realloc_impl mozmem_malloc_impl(realloc)

   Which I really didn't feel like digging into.

 * I had to restore the order of TrustOverrideUtils.h and related files in nss
   because the .inc files depend on TrustOverrideUtils.h being included earlier.

 * I had to add a missing include to RollingNumber.h

 * Also had to partially restore include order in JsepSessionImpl.cpp to avoid
   some -WError issues due to some static inline functions being defined in a
   header but not used in the rest of the compilation unit.

Differential Revision: https://phabricator.services.mozilla.com/D60327

--HG--
extra : moz-landing-system : lando
2020-01-20 16:19:48 +00:00
Emilio Cobos Álvarez aa3a695712 Bug 1609996 - Remove mozilla/Move.h. r=froydnj
rg -l 'mozilla/Move.h' | xargs sed -i 's/#include "mozilla\/Move.h"/#include <utility>/g'

Further manual fixups and cleanups to the include order incoming.

Differential Revision: https://phabricator.services.mozilla.com/D60323

--HG--
extra : moz-landing-system : lando
2020-01-20 16:18:20 +00:00
Henri Sivonen 8f73b57bca Bug 1600561 - Handle eCompositionCommitAsIs in ContentCacheInParent::OnCompositionEvent. r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D55417

--HG--
extra : moz-landing-system : lando
2019-12-02 15:27:29 +00:00
Ryan Hunt 0eeced87be Bug 1534395 - Rename TabParent to BrowserParent. r=nika
This commit renames TabParent to BrowserParent.

Differential Revision: https://phabricator.services.mozilla.com/D28133

--HG--
rename : dom/ipc/TabParent.cpp => dom/ipc/BrowserParent.cpp
rename : dom/ipc/TabParent.h => dom/ipc/BrowserParent.h
extra : rebase_source : d2706b9f42177d8de16068b7b1d088a44b8720a4
extra : histedit_source : a617ddac45c58050ef799116a67d2d983f2a8f6d%2C1d1dabd8761a32d548a6fbf1027be960698f6a5e
2019-04-09 16:38:15 -05:00
Sylvestre Ledru 265e672179 Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
# ignore-this-changeset

--HG--
extra : amend_source : 4d301d3b0b8711c4692392aa76088ba7fd7d1022
2018-11-30 11:46:48 +01:00
Emilio Cobos Álvarez fffb25b74f Bug 1465585: Switch from mozilla::Move to std::move. r=froydnj
This was done automatically replacing:

  s/mozilla::Move/std::move/
  s/ Move(/ std::move(/
  s/(Move(/(std::move(/

Removing the 'using mozilla::Move;' lines.

And then with a few manual fixups, see the bug for the split series..

MozReview-Commit-ID: Jxze3adipUh
2018-06-01 10:45:27 +02:00
Masayuki Nakano 6e70ab6b93 Bug 1422230 - part 2: ContentCacheInParent should allow to query content relative to composition string even after sending eCompositionCommit(AsIs) event but not yet handled in the remote process r=m_kato
Currently, ContentCacheInParent uses selection when it handles query content
event whose input offset is relative one after sending eCompositionCommit(AsIs)
event but it's not yet handled by the remote process.  However, in this case,
selection may not be modified with committed string.

So, when mPendingCommitCount is not 0, ContentCacheInParent should compute
absolute offset with the latest composition string information.  For doing
this, it needs to keep storing mCompositionStart until eCompositionCommit(AsIs)
is handled in the remote process actually.

MozReview-Commit-ID: 2Dc69HNIbvh

--HG--
extra : rebase_source : 4be432ad363022e4b3f2e3c82c8d229dc9af889d
2018-01-12 15:05:24 +09:00
Milan Sreckovic bd27b86da3 Bug 1423559: Use BaseRect access methods instead of member variables in widget/ r=mstange
MozReview-Commit-ID: AqnztoUbsmk

--HG--
extra : rebase_source : 76a232a08b42ed73b4922c03bc0f2e9d1769203b
2018-01-10 11:14:16 -05:00
Masayuki Nakano 600d0e1cd9 Bug 1423456 - ContentCacheInParent::OnEventNeedingAckHandled() shouldn't decrement mPendingCompositionCount when it receives eCompositionCommit(AsIs) from the remote process but the composition has already been committed by a request to commit composition r=m_kato
After fixing bug 1420849, remote process started to ignore composition events
after it synthesizes eCompositionCommit event after requesting to commit
composition.  However, remote process still keeps returning composition events
when it receives from the main process.  So, if the main process has already
sent eCompositionCommit(AsIs) event when it's requested to commit composition
from the remote process, ContentCacheInParent::OnEventNeedingAckHandled()
receives both eCompositionCommitRequestHandled and eCompositionCommit(AsIs)
events for *a* composition.  Therefore, mPendingCompositionCount may be
decremented twice for a composition.  This causes hitting MOZ_DIAGNOSTIC_ASSERT.

So, ContentCacheInParent need to manage if sent composition events are ignored
or not.  Then, ContentCacheInParent::OnEventNeedingAckHandled() stops
decrementing mPendingCompositionCount when it receives eCompositionCommit(AsIs)
events which are ignored by the remote process.

This patch manages it with |mIsChildIgnoringCompositionEvents| and changes
|bool mIsPendingLastCommitEvent| to |uint8_t mPendingCommitCount| for
making ContentCache be able to manage multiple pending commit events if
its remote process is too busy.

MozReview-Commit-ID: CYQDeZXl7TJ

--HG--
extra : rebase_source : 6de1e2f1302d556d45d19c73b4d1ea3f86b65373
2017-12-06 15:07:41 +09:00
Masayuki Nakano 8418b1b497 Bug 1420849 - Make PuppetWidget discard composition events after requesting commit composition and synthesizing eCommitComposition event until new eCompositionStart event comes r=m_kato
When ContentCacheInParent::RequestIMEToCommitComposition() returns true,
the remote process will synthesize eCompositionCommit event.  This causes
destroying TextComposition event in the remote process (by
IMEStateManager::DispatchCompositionEvent()).  Then,
IMEStateManager::DispatchCompositionEvent() will recreate new TextComposition
instance when it receives new composition event.  Then, it may request
to commit composition to the main process via PuppetWidget accidentally.

So, after PuppetWidget::RequestIMEToCommitComposition() synthesizes
eCompositionCommit, PuppetWidget should discard following composition events
until it receives eCompositionStart since they are unnecessary for the content
and they are for the old composition, i.e., outdated events.

MozReview-Commit-ID: BNRcoYxABpd

--HG--
extra : rebase_source : caea469afeed8cc373aeca33199ac0d570052569
2017-11-27 20:34:01 +09:00
Masayuki Nakano b1a20692e4 Bug 1418747 - ContentCacheInParent needs to initialize mPendingCommitLength with 0 when it's created r=m_kato
ContentCacheInParent::mPendingCommitLength is never initialized until it
receives eCompositionCommit(AsIs) event from widget or receives the latest
content from the remote process when there is a composition.

The bug is, immediately after dispatching eCompositionStart and first
eCompositionChange event, MS Pinyin tries to query the character at caret,
but ContentCacheInParent::HandleQueryContentEvent() tries to resolve
related position of an eQueryTextRect event with the uninitialized
mPendingCommitLength.  Therefore, the query almost always fails and MS Pinyin
gives up to show its candidate window.

This patch just initializes the member with 0.

MozReview-Commit-ID: JyYNqi8hoTa

--HG--
extra : rebase_source : bdc504f83abdbb21e11ea69290908ed501e9a65f
2017-11-27 18:51:01 +09:00
Gabriele Svelto cbb30621ec Bug 1402519 - Remove MOZ_CRASHREPORTER directives from widget; r=froydnj
--HG--
extra : rebase_source : 4472a8d6ce5edf1b5a4665d522a1816020308a43
2017-11-23 10:59:04 +01:00
Masayuki Nakano 02815812a9 Bug 1405832 - part 4: ContentCacheInParent::OnEventNeedingAckHandled() shouldn't crash in release build r=m_kato
For protecting main process, we should stop crashing main process in release
build even when we detect our bug.  However, we should keep crashing with
MOZ_DIAGNOSTIC_ASSER which is enabled only on Night and Developer Edition.

MozReview-Commit-ID: 5BQ46IFzXXj

--HG--
extra : rebase_source : 1a894bb23b6b9f386b19eba95d14cd8db80fb2c6
2017-11-20 23:30:18 +09:00
Masayuki Nakano 07dc211d1a Bug 1405832 - part 3: ContentCacheInParent::RequestIMEToCommitComposition() should call nsIWidget::NotifyIME() via TextComposition::RequestToCommit() r=m_kato
Now, TextComposition::RequestToCommit() manages if it has already requested
IME to commit or cancel composition and this is important for redundant
requests.  Therefore, ContentCacheInParent::RequestIMEToCommitComposition()
shouldn't call nsIWidget::NotifyIME() directly.

MozReview-Commit-ID: 69VpgyK9Jk5

--HG--
extra : rebase_source : 5b86c11669c7a69ceb0a2af155765834621ee968
2017-11-20 23:08:37 +09:00
Masayuki Nakano b07eba4f1e Bug 1405832 - part 1: ContentCacheInParent::RequestIMEToCommitComposition() should increment mPendingEventsNeedingAck itself if it treat the request handled synchronously without actually requesting IME to commit composition r=m_kato
This is a simple bug of ContentCacheInParent.  When
ContentCacheInParent::RequestIMEToCommitComposition() returns true,
PuppetWidget::RequestIMEToCommitComposition() will send
eCompositionCommitRequestHandled pseudo event message back to the main process.
This causes counting down mPendingEventsNeedingAck in
ContentCacheInParent::OnEventNeedingAckHandled().  Therefore, in the normal
path, ContentCacheInParent::OnCompositionEvent() increments it for receiving
the pseudo event message.

However, if the tab parent has already lost focus,
RequestIMEToCommitComposition() returns true without requesting native IME to
commit composition.  So, ContentCacheInParent::OnCompositionEvent() cannot
increment mPendingEventsNeedingAck for coming
eCompositionCommitRequestHandled.  Therefore, RequestIMEToCommitComposition()
needs to increment mPendingEventsNeedingAck by itself when it won't request
IME to commit composition but it returns true.

MozReview-Commit-ID: 4Alwfy8avB

--HG--
extra : rebase_source : 2588221568440beecc2b992910fa53729b8abe1c
2017-11-20 22:20:02 +09:00
Masayuki Nakano 8830e5ebb9 Bug 1409656 - Append log of ContentCacheInParent::RequestIMEToCommitComposition() in the latest 2 sets of composition events to app notes of crash report when ContentCacheInParent::OnEventNeedingAckHandled() meets unexpected state and crash itself r=m_kato
This is a follow up patch of bug 1408086.  The previous patch starts to append
log of 2 sets of composition events to app notes of crash report when
ContentCacheInParent::OnEventNeedingAckHandled() meets unexpected state and
crash itself.  However, now, we know the unexpected state occurs when TabParent
receives eCompositionCommitRequestHandled message from its remote process.
The event comes when ContentCacheInParent::RequestIMEToCommitComposition()
returns true.  So, we need to know what occurs in the method before the crash.

This patch defines each case of RequestIMEToCommitComposition() with an enum
class, RequestIMEToCommitCompositionResult and make
RequestIMEToCommitComposition() append one of its value to the array.
Then, ContentCacheInParent discards unnecessary log of this when it discards
log of old composition events.  Finally, appends the log to the app notes of
crash report.

MozReview-Commit-ID: 9sJyl4SvUXu

--HG--
extra : rebase_source : f7e90a157d3819523d3d8932d9f8af5d94e2db1f
2017-10-19 00:13:42 +09:00