tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit 6388480bb1935f36b915b339185f51ff6303125c
parent 7b20ce3fa33b12ad9625b0e232aa447294c90761
Author: Makoto Kato <m_kato@ga2.so-net.ne.jp>
Date:   Mon, 10 Nov 2025 23:52:57 +0000

Bug 1995911 - Don't always attatch GeckoEditable when child doucments are created. r=geckoview-reviewers,tcampbell

`PuppetWidget` in child process and `nsWindow` in parent process have a binder
session to communicate IME.

When DOM document is created, we attach `GeckoEditable` that is both
parent process and child process. But If child document in iframe is created,
we also re-attach both. Then, when re-attaching `GeckoEditable`, we also
reset IME to synchronize Gecko's text.

It is unnecessary to re-attach `GeckoEditable` if child's `PupeetWidget` has
attached `GeckoEditble`. Because parent's `GeckoEdiable` is always same,
and it is associated with `GeckoSession`.

So we should avoid to re-attach `GeckoEditable`.

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

Diffstat:
Mwidget/android/GeckoEditableSupport.cpp | 12+++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/widget/android/GeckoEditableSupport.cpp b/widget/android/GeckoEditableSupport.cpp @@ -1565,6 +1565,8 @@ InputContext GeckoEditableSupport::GetInputContext() { } void GeckoEditableSupport::TransferParent(jni::Object::Param aEditableParent) { + ALOGIME("IME: TransferParent, mIMEFocusCount=%d", mIMEFocusCount); + AutoGeckoEditableBlocker blocker(this); mEditable->SetParent(aEditableParent); @@ -1662,9 +1664,13 @@ void GeckoEditableSupport::SetOnBrowserChild(dom::BrowserChild* aBrowserChild) { support->mEditableAttached = true; } - // Transfer to a new parent that corresponds to the BrowserChild. - java::GeckoServiceChildProcess::GetEditableParent(support->GetJavaEditable(), - contentId, tabId); + MOZ_ASSERT(support->mEditable); + + if (!support->mEditable->HasEditableParent()) { + // Transfer to a new parent that corresponds to the BrowserChild. + java::GeckoServiceChildProcess::GetEditableParent( + support->GetJavaEditable(), contentId, tabId); + } } nsIWidget* GeckoEditableSupport::GetWidget() const {